Run Excel Macro from Outside Excel Using VBScript From Command Line
问题 I'm trying to run an Excel macro from outside of the Excel file. I'm currently using a ".vbs" file run from the command line, but it keeps telling me the macro can't be found. Here is the script I'm trying to use Set objExcel = CreateObject("Excel.Application") Set objWorkbook = objExcel.Workbooks.Open("test.xls") objExcel.Application.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Test value" objExcel.Application.Run "Macro.TestMacro()" objExcel.ActiveWorkbook.Close