View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Schatzi Schatzi is offline
external usenet poster
 
Posts: 16
Default Disable save/saveas dialog box upon closing

On May 3, 2:08*pm, Gord Dibben wrote:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
* * Me.Saved = True
End Sub

Will close without saving or asking.

NOTE: after inserting code you must save the workbook once.

Gord Dibben * * MS Excel MVP

On Tue, 3 May 2011 11:50:44 -0700 (PDT), Schatzi
wrote:



I saw another topic on this where the user wanted to automatically
save. I have macros running that disable saving and want the dialog
box not to automatically pop-up as the save button on it doesn't work
anyway.


I was trying all kinds of code such as:


Sub Auto_Close()
WorkbookObject.Saved = True
WorkbookObject.Close
End Sub


I also tried:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
End Sub


Still, when I close the application, I get the box asking if I would
like to save changes. How do I keep this box from automatically
popping up? I searched other answers and saw that they recommended
code that automatically saved it, but that is different. I thought I
would be able to simply adjust the code, but I couldn't figure that
out.


Also, I am using ThisWorkbook as I imagine that is the right place for
such code. Please correct me if I am wrong. Thank you.- Hide quoted text -


- Show quoted text -


Gordon, I just put in your code and it worked perfect. Thank you all
for the replies.