I know there are other posts similar to this but I cannot seem to get this to work. I just want to create a .vbs file to use with the scheduler to kick off a macro in Excel on monthly basis. Here is what I have been trying:
Option Explicit
Dim xlApp
Dim xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("C:\Test\TEST.xlsm", 0, True)
xlApp.Run "Macro1"
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
WScript.Quit
I just get a warning message every time saying that TEST.xlsm already exists and do I want to overwrite it. When I click Yes, the changes never take effect.
I don't want to get any message at all, and I don't know why the changes from the macro are not occurring.
I've tried to use
xlApp.SaveAs
and I cannot get that to work either. Plus the workbook appears to not be closing correctly.
Thanks in advance, I am new to this so maybe I am just missing something stupid.