Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Disabling Close Window Save Option

Status
Not open for further replies.

f64

Technical User
May 23, 2003
24
US
I am trying to disable the "Do You Want to Save Changes ..." dialog that appears when you click the Close Window button in Excel.

When I entered the following;

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

An error message is generated after clicking the Close Window Button

EXCEL.EXE - Application Error
The instruction at " " referenced memory at " ".
The memory could not be "read".

This is using EXCEL 2000 in Windows 2000. What am I doing wrong?
 
Have you tried this ?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Saved = True
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top