To "accept the challenge", I just created a batch file using these steps (which work).
First, you ask... how do I "run" an Excel macro from a batch file, so I expect you know how to "create" batch files.
Step 1) - Determine which folder your "Excel.exe" file is located in. As you liekly know, you can do this by right-clicking on your Excel icon and checking the Properties.
It will likely be located in the following folder...
"C:\Program Files\Microsoft Office\Office\EXCEL.EXE"
Because batch files are run from DOS, you'll need to reference the "DOS" names for the location of the Excel.exe file.
For example, using the above location, you would use...
C:\progra~1\micros~1\office\excel.exe
Step 2) Do the same - determine the path (in DOS names) for the Excel ("xls" file that you want to load.
Step 3) In the batch file, combine the two lines, with a space between them. e.g.
C:\progra~1\micros~1\office\excel.exe c:\myfolder\excel\workbo~1\workbo~1.xls
I expect you'll know that the above has to be on ONE line in your batch file.
Step 4) After creating the batch file, you could also create a desktop shortcut for it.
Step 5) In the Excel file itself, create a "Workbook Open event" for running your macro when the file is opened.
I hope this helps. Please advise as to how you make out.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.