Answers for "code to run macro in vba"

VBA
0

excel vba run macro from command line

Option Explicit
On Error Resume Next
ExcelMacroExample

Sub ExcelMacroExample() 
  Dim xlApp 
  Dim xlBook 

  Set xlApp = CreateObject("Excel.Application") 
  Set xlBook = xlApp.Workbooks.Open("C:MyWorkbook.xlsm", 0, True) 
  xlApp.Run "MyMacro"
  xlApp.Quit 

  Set xlBook = Nothing 
  Set xlApp = Nothing 

End Sub
Posted by: Guest on February-06-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language