Close excel file wothout prompt (vbscript)

  • Thread starter Thread starter Karuna
  • Start date Start date
K

Karuna

Hello,

I have a vbscript that edits one of the excel file. When I try to close the
file using the below code, it prompts me "Do you want to save changes you
made to test.xls".

Set obj = CreateObject("excel.application")
Set objExcel1 = obj.Workbooks.Open("C:\test.xls")
..
..
..
objExcel1.Close

I want this excel sheet to be closed without saving the changes made during
the execution of the script. I dont want to have manual intervension where it
asks prompts me to click "yes", "no" or "cancel".

Awaiting for anyone who can share their view in this regard.

Thanks in advance.
Karuna.
 
Karuna said:
Hello,

I have a vbscript that edits one of the excel file. When I try to close the
file using the below code, it prompts me "Do you want to save changes you
made to test.xls".

Set obj = CreateObject("excel.application")
Set objExcel1 = obj.Workbooks.Open("C:\test.xls")
.
.
.
objExcel1.Close

I want this excel sheet to be closed without saving the changes made during
the execution of the script. I dont want to have manual intervension where it
asks prompts me to click "yes", "no" or "cancel".

Awaiting for anyone who can share their view in this regard.

Thanks in advance.
Karuna.

I got the solution :
objExcel.Close False
 
Back
Top