PDA

View Full Version : Solved: Closing an Excel Workbook without "Save" Prompt



jcoleman53
03-09-2005, 09:44 AM
I have been trying to write some VB code for disabling the "Save Changes" prompt when closing a workbook. I followed the instructions for writing an Auto_Close macro (from microsoft tech site), but it doesn't seem to work. It keeps on asking if I want to save changes. Am I misunderstanding something? Isn't this macro supposed to run "automatically" when the user closes the file? I'm working in Excel 2000. Thanks.

Richie(UK)
03-09-2005, 10:01 AM
Hi J,

Welcome to the forum.

I'd recommend that you adopt the 'new' events rather than the 'old' Auto procedures. Right-click on the Excel icon to the left of the File menu in Excel and select View Code - this will take you to the ThisWorkbook object.

In the ThisWorkbook code pane insert the following:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.Saved = True
End SubThat should do what you want.

jcoleman53
03-10-2005, 06:30 AM
Richie:

Worked like a charm. Thanks.