Close file without saving

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My current program looks like the following:

Private Sub Auto_Close()
ThisworkBook.Save
ThisworkBook.Close
End Sub

The above saves the file and closes it automatically when the user exits the
file and no prompts are generated.

Could someone please show me what the code would look like to insead close
the file WITHOUT saving and WITHOUT generating a "Do you want to save?"
prompt?
 
Hi,

Private Sub Auto_Close()
ThisWorkbook.Saved = True 'does not save the workbook, only marks i
as saved
ThisWorkbook.Close False
End Sub

or

Private Sub Auto_Close()
Application.DisplayAlerts = False 'to eliminate prompt "Do you wan
to save?"
ThisWorkbook.Close SaveChanges:=False
End Sub


Jare
 
Hi,
I'm having problems with this one. I am entering your second code in "this
workbook" after other code. The application display alerts is still showing
the "do you want to save" screen and I'm getting an error message when I put
in - this workbook. close savechanges: = false
Any ideaqs ?
Mike
 
hi.i'm only starting to learn this, but try calling the next macro before the
end of your first macro...

like before "end sub", type "call (your macro name)"

learned it from joel... thanks joel
 

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

Back
Top