I am trying to use the following vbs to run a Macro in the test.xlsm file. However, when I am running this, it throws an error indicating there is an error in line 9: This class does not support Automation "objWorkbook.Close".
I have checked the solutions online, for example, changing objWorkbook.Close False to objWorkbook.Close(False); changing the compatibility of Excel, however, none of those worked.
The opened Excel doesn't seem to be able to close...
Any idea how to fix it? It's really appreciated if it can be fixed!
Dim args, objExcel
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook =
objExcel.Workbooks.Open("C:\Users\Daisy\Desktop\VBA\test.xlsm")
objExcel.DisplayAlerts = False
objExcel.workbooks.Open "C:\Users\Daisy\Desktop\VBA\test.xlsm", 0, True
objExcel.visible = True
objExcel.Run "test.xlsm!ScheduleARunForTomorow"
objWorkbook.Close False
objExcel.Application.Quit
WScript.Echo "Finished."
WScript.Quit
objExcel.workbooks.Open "C:\Users\Daisy\Desktop\VBA\test.xlsm", 0, True
, createdtest.xlsm
with macro and it works for me - which version of office are you using? – avbDisplayAlerts = False
is rather dangerous, and here's no need to use it - in this case it probably did not let you see the real error message – avb