I have a VB Script that opens an Excel file and runs a macro. I am trying to close this excel file(without saving any changes) without being prompted to save. I have set the 'Saved' property to true. But I am still prompted with the Save window. I read somewhere that I have to disable the macro. Not sure how? I would like to close the excel file without saving and without prompting.
Dim objExcel, objWorkbook
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("c:\aaa\Test.xls")
objExcel.Visible = True
objExcel.Run "Extract_PLStatements"
objworkbook.Saved = True
objWorkbook.Close
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
WScript.Quit
This should do it:
objExcel.DisplayAlerts = False
objWorkbook.Close False