Closing workbook without saving changes

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
 
D

Danny

Try in macro in the MODULE:

Sub Auto_Close()
ThisWorkbook.Close SaveChanges:=False
End Sub
 

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