Stop excel prompt asking if you want to save changes

Posted on 2009-02-09
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 (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


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

Open in new window

Question by:ross13
    LVL 1

    Accepted Solution

    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

    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

    Thanks. Great help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    If you haven’t already, I encourage you to read the first article ( in my series to gain a basic foundation of R and R Studio.  You will also find the …
    This article will show, step by step, how to integrate R code into a R Sweave document
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now