Stop excel prompt asking if you want to save changes

I have been writing an application that needs to save a document in .csv format. I have managed to get the application to work but it prompts me to save changes (please see the attached file).

The code that I am using in shown in the snippet below but I would be grateful if someone could provide information on how to stop getting this prompt and select yes.

I dont know if there is also any documentation available on objects that you create within vb.net (e.g Dim oExcel As Object = CreateObject("Excel.Application")) to describe the various methods and parameters that are available to the programmer.
With this being a user defined object I dont get the information from within vb.net.

Thanks
 

oBook.SaveAs("C:\tempOpenItems.csv", Excel.XlFileFormat.xlCSVWindows)

Open in new window

PopUp.doc
ross13Asked:
Who is Participating?
 
AshlokConnect With a Mentor Commented:
Look at article ID: 22774078
There is an Excel ADD IN to download that will stop this prompt from coming up when closing out of Excel. Excel will always ask you save a CSV when closing even if you already saved the file...
0
 
DhaestConnect With a Mentor Commented:
Add this command in your vb code right at the top and it will take care of the same...

Application.DisplayAlerts = False

Then right before the end sub add this line to set it back to true again...

Application.DisplayAlerts = True
0
 
ross13Author Commented:
Thanks. Great help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.