Run executable file

S_Wish

Board Regular
Joined
Jan 4, 2017
Messages
216
Hi! I have a problem with self-written *.exe program which is working with current directory. When i run it manually, it does fine. but if i try to do it using VBA - the pass to current directory changes (like excel copies it to some directory and run). can someone explain me how excel runs executables? because now i had to change pass to static in *.exe program, and it is not convinient for future usage.

Thanks in advance.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi! I have a problem with self-written *.exe program which is working with current directory. When i run it manually, it does fine. but if i try to do it using VBA - the pass to current directory changes (like excel copies it to some directory and run). can someone explain me how excel runs executables? because now i had to change pass to static in *.exe program, and it is not convinient for future usage.

Thanks in advance.

Look for the Shell Command
 
Upvote 0
just to be clear, i do use shell
here is my code
Code:
Call Shell(ThisWorkbook.Path & "\MYFILE.exe", vbNormalFocus)
error in Pass:
for example my file is in directory: D:\work\
and after calling shell i get error with pass
C:\Users\me\Documents\
 
Upvote 0
any thoughts why it moves my .exe file to directory C:\Users\me\Documents\ to run instead D:\work\ ?? and how to cure it?
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top