Learn how to a build a cloud-first strategyRegister Now


Stop excel prompt asking if you want to save changes

Posted on 2009-02-09
Medium Priority
Last Modified: 2012-05-06
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.


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

Open in new window

Question by:ross13

Accepted Solution

Ashlok earned 1000 total points
ID: 23593019
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...
LVL 53

Assisted Solution

Dhaest earned 1000 total points
ID: 23598101
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

Author Closing Comment

ID: 31544658
Thanks. Great help.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question