I have a vbscript that opens an excel workbook and runs a particular macro inside at a particular time on a particular day. Here it is
Option Explicit
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
While not (Month(Now()) = 11 and Day(Now()) = 17 and Hour(Now()) = 9 and Minute(Now()) = 1)
Wend
Set xlBook = xlApp.Workbooks.Open("C:\Temp\Property by Peril.xlsm")
xlApp.Application.Run "'Property by Peril.xlsm'!Main"
Set xlBook = Nothing
Set xlApp = Nothing
WScript.Echo "Finished."
WScript.Quit
It runs fine up to and including the opening of the workbook and the running of the macro. However, immediately after the macro runs, I get an error
Microsoft VBScript runtim error: Unknown runtime error (on line 16)
and the rest of the script does not get executed.
Any thoughts/help?
.Run "Main")? Also which one isline 16?.Runline, which is odd because that line runs fine. It's just the ones after that don't run and the error is triggered.xlApp.closeline or something that will close the file before setting references toNothing? can you share the code fromMain?