troubleshooting Question

Running folder

Avatar of leonstryker
leonstrykerFlag for United States of America asked on
Microsoft DOSMicrosoft Excel
5 Comments1 Solution391 ViewsLast Modified:
I am running some code in VBA which executes a BAT files with a Shell command. The BAT calls some exe files. It is important that the Excel file be in the same folder as the BAT and the EXE files for everything to work.

My issue is that if the Excel file is opened from the Recent Files list and the code is executed, the start up location is different than the one where the Workbook has been saved. This cause the BAT code to fail since the EXE files can not be found. The only thing that seems to help is to do a Save As to re-save the workbook in the proper folder.

I have tried adding ChDir command before running the code, but that does not seem to help.

Solutions and suggestions are welcome.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros