excel - File not found error when running an exe using Shell function -


i running sub userform supposed run exe file, found in working folder, follows:

sub runprocessor()     if msgbox("run simulation?", vbyesno) = vbno       exit sub     else       chdir thisworkbook.path       shell ("runsims.exe")     end if end sub 

this working fine on local drive, started fail when moved server drive (run-time error 5 on shell function call line).

i know in cmd, when working on c: drive , cd l:\...\...\ call, need enter l: well, tried insert line of code above other shell call: shell (left(thisworkbook.path, 2)) failed. how can have "runsims.exe" run, given in current working drive?

chdir work change current directory on same drive - need use chdrive first if want switch folder on different drive.

better yet, pass full path shell , skip changing current directory.

sub runprocessor()     if msgbox("run simulation?", vbyesno) = vbyes         shell (thisworkbook.path & "\runsims.exe")     end if end sub 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -