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
I finally created a VB Script and launched it from the command line:
Option Explicit
LaunchMacro
Sub LaunchMacro()
Dim xl
Dim xlBook
Dim sCurPath
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set xl = CreateObject("Excel.application")
Set xlBook = xl.Workbooks.Open(sCurPath & "\MyWorkBook.xlsm", 0, True)
xl.Application.Visible = True
xl.Application.run "MyWorkBook.xlsm!MyModule.MyMacro"
xl.DisplayAlerts = False
xlBook.saved = True
xl.activewindow.close
xl.Quit
Set xlBook = Nothing
Set xl = Nothing
End Sub