Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    VBA code for closing a file without saving it (Excel 2002)

    Hi!
    I have the code below in my macro to close the active file, however when I run the macro Excel asks me if I want to save the changes of the file I'm closing. How do I change the code below to answer that question automatically as "no" or "false". I'm assuming I need to put something with the ActiveWorkbook.Save command??

    ActiveWindow.Close

    Thanks!
    Lana

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA code for closing a file without saving it (Excel 2002)

    Does this do what you want?

    <code>
    Application.DisplayAlerts = False
    ActiveWorkbook.Close Savechanges:=False
    Application.DisplayAlerts = True
    </code>
    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Ankeny, Iowa, USA
    Posts
    344
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: VBA code for closing a file without saving it (Excel 2002)

    Perfect!
    Thanks Legare!
    Lana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •