Consulting

Results 1 to 3 of 3

Thread: Solved: Closing an Excel Workbook without "Save" Prompt

  1. #1

    Solved: Closing an Excel Workbook without "Save" Prompt

    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.

  2. #2
    VBAX Contributor Richie(UK)'s Avatar
    Joined
    May 2004
    Location
    UK
    Posts
    188
    Location
    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:
    [vba]Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Me.Saved = True
    End Sub[/vba]That should do what you want.

  3. #3
    Richie:

    Worked like a charm. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •