Close excel file wothout prompt (vbscript)

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.
 
K

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top