Is it possible to launch an Excel Macro from command line?
I don't want to use the Worksheet_Open
event and just open the Excel File.
I need to launch specific macro that exists in the Excel WorkBook.
Is it possible to launch an Excel Macro from command line?
I don't want to use the Worksheet_Open
event and just open the Excel File.
I need to launch specific macro that exists in the Excel WorkBook.
AutoIt also offers great COM support and has a lot of built-in Excel-controlling functions. You can compile the script to an .EXE and then run it from the command line.
Use the Windows PowerShell, it has excellent COM interop support.
I have the workbook c:\TestBeep.xlsm with a macro called "Test". This is my transcript:
Optionally you can add in
$app.Visible = $True
to make the window visible.If you would prefer to code in C# use this template
Thank you! Mehdi your answer worked for me too with a small adjustment. The line
xl.Application.Visible = True
was leaving open a zombie/phantom EXCEL.EXE process using up memory (found it through Windows Task Manager). Usingxl.Application.Visible = False
instead seems to eliminate the zombie.Finally i used a VB Script and launched it from Command Line. This was my solution :