Tag: vbscript

从命令行使用VBScript从外部Excel运行Excelmacros

我试图从Excel文件之外运行Excelmacros。 我目前使用从命令行运行的“.vbs”文件,但它一直告诉我无法findmacros。 这是我正在尝试使用的脚本 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 objExcel.Application.Quit WScript.Echo "Finished." WScript.Quit 这里是我试图访问的macros: Sub TestMacro() 'first set a string which contains the path to the file you want to create. 'this example creates one and stores it in the root […]