Close Without Saving

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

Is there a property you can set in a workbook so that when you close it
manually (clicking the 'x' in the upper right) that it will shut it down
without saving any changes and without prompting to save?

TIA,
Dennis
=========
 
right click on the excel logo in the upper LEFT of the workbook next to
FILE>view code>insert this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Close savechanges:=False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Close savechanges:=False
End Sub
 
Works great!!!! Thanx Don!


"Don Guillett" said:
right click on the excel logo in the upper LEFT of the workbook next to
FILE>view code>insert this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Close savechanges:=False
End Sub


Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Close savechanges:=False
End Sub
 
I tried ------

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Close SaveChanges:=False
End Sub

in Excel97 on a Win98 PC and it didn't work. I still got prompted to save
the changes.

So I tried ---------

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

and it works perfectly.

I have transferred the workbook to a laptop running Excel 2000 and Win XP.
For some reason the "Saved = True" method doesn't seem to have any effect
and I am getting the Yes/No/Cancel message box again. I haven't yet had a
chance to try the "SaveChanges = False" alternative - but then, it didn't
work the last time!
Any ideas on all of this?

Eric
 
Back
Top