Running a macro from the command line

C

Czech

How do you use the command line to run a specific macro on a specific xls
file?

In Word, I use this syntax:

winword FileName /mMacroName

But doing this in Excel opens Excel but does not run the macro:

excel FileName /mMacroName
 
J

Jim Rech

Excel does not support naming a macro to run from the command line. The
only macro that runs automatically with a workbook opening is its
WorkBook_Open event handler and a sub named Auto_Open if one exists. If
these routines could find the name of the macro you wanted run they could
run it. Maybe in an INI file or in the registry? I've never had to do
this.

--
Jim Rech
Excel MVP
| How do you use the command line to run a specific macro on a specific xls
| file?
|
| In Word, I use this syntax:
|
| winword FileName /mMacroName
|
| But doing this in Excel opens Excel but does not run the macro:
|
| excel FileName /mMacroName
|
| --
| Karel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top