ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a macro from the command line (https://www.excelbanter.com/excel-programming/315124-running-macro-command-line.html)

Czech

Running a macro from the command line
 
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

Jim Rech

Running a macro from the command line
 
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
"Czech" wrote in message
...
| 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




All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com