Close Without Saving

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
=========
 
D

Don Guillett

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
 
D

Dennis

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
 
E

EP

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
 

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

Top