hi everyone,
i want to run my code in excel vba by using cmd (command prompt).
i've tried some code that i get from the internet but it still didn't work.
is it really possible?
here is my macro
sub a()
Msgbox ("ABCD")
end sub
And here is my code
RunMacro
Sub RunMacro()
Dim xl
Dim xlBook
Dim sCurPath
Set xl = CreateObject("Excel.application")
Set xlBook = xl.Workbooks.Open("E:\z.xlsm", 0, True)
xl.Application.Visible = False
xl.DisplayAlerts = False
xl.Application.run "z.xlsm!Module.RunMacro"
xl.ActiveWindow.close
xl.Quit
Set xlBook = Nothing
Set xl = Nothing
End Sub
Thanks
Bookmarks