I am trying to get an excel file to open up every morning at 5am, run a macro which pulls in data and filers/organizes the data, save the file and then close it. I currently have the task manager with the .vbs script to open the file which is below, and the file opens, but as it closes the Save window pops up, and tries to save the file as a copy of the original.
Option Explicit
Dim xlApp, xlBook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
' Import Add-Ins
'xlApp.Workbooks.Open "G:\CNC\Schiermeyer\Active Job Files\Autorefresh" "C:\<pathOfXlaFile>\MyMacro.xla"
'xlApp.AddIns("MyMacro").Installed = True
'Open Excel workbook
Set xlBook = xlApp.Workbooks.Open("G:\CNC\Schiermeyer\Active Job Files\Autorefresh\AutoRefresh Active Job Report.xlsm", 0, True)
' Run Macro
xlApp.Run "sheet1.ActiveJobReportRefresh"
xlBook.Close
xlApp.Quit
Set xlBook = Nothing
Set xlApp = Nothing
WScript.Quit
Any help would be greatly appreciated. I am new to using Task manager & .vbs files, and still not a pro with VBA, this is just as far as I have gotten using forums.
I created a module and inserted the below code:
But this module is created where when the user click the close (X) on top right, excel will save and close by not asking confirmation. Perhaps you can try to modify this code. Thank you.