+ Reply to Thread
Results 1 to 5 of 5

How to get custom dialog box when exiting Excel Spreadsheet

  1. #1
    Aardvark
    Guest

    How to get custom dialog box when exiting Excel Spreadsheet

    On Excel XP I would like for a message box to come up when exiting a
    spreadsheet as a reminder to check certain items. Is this possible?

  2. #2
    Norman Jones
    Guest

    Re: How to get custom dialog box when exiting Excel Spreadsheet

    Hi Aardvaak,

    Try:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim Res As Long
    Res = MsgBox("Have you...", vbYesNo)
    Cancel = Res <> 6

    End Sub

    This is workbook event code and should be pasted into the workbook's
    ThisWorkbook module:

    Right click the Excel icon on the worksheet (or the icon to the left of the
    File menu if your workbook is maximised) | Select View Code from the
    resultant menu, and paste the code. Alt-F11 to return to Excel..


    ---
    Regards,
    Norman



    "Aardvark" <[email protected]> wrote in message
    news:[email protected]...
    > On Excel XP I would like for a message box to come up when exiting a
    > spreadsheet as a reminder to check certain items. Is this possible?




  3. #3
    Registered User
    Join Date
    08-02-2005
    Posts
    4
    I tried this and it didn't work. It just gave me an error when I re-opened the workbook saying the macros were disabled.

  4. #4
    Norman Jones
    Guest

    Re: How to get custom dialog box when exiting Excel Spreadsheet

    Hi Chriskxp2123,

    (1) Where did you put the code?
    (2) When you close the workbook, did the message box appear for you?
    (3) If your reponse to (2) is affirmative, did you try responding "No"?
    (4) When you re-opened the file did you agree to "Enable Macros"?
    (5) Are *you* Aardvark"?


    ---
    Regards,
    Norman



    "chriskxp2123" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I tried this and it didn't work. It just gave me an error when I
    > re-opened the workbook saying the macros were disabled.
    >
    >
    > --
    > chriskxp2123
    > ------------------------------------------------------------------------
    > chriskxp2123's Profile:
    > http://www.excelforum.com/member.php...o&userid=25833
    > View this thread: http://www.excelforum.com/showthread...hreadid=392933
    >




  5. #5
    Aardvark
    Guest

    Re: How to get custom dialog box when exiting Excel Spreadsheet

    Thanks Norman Jones. It worked great. This was my first time in this
    discussion group, I am so excited about having another avenue for information.

    Aardvark

    "Norman Jones" wrote:

    > Hi Aardvaak,
    >
    > Try:
    >
    > Private Sub Workbook_BeforeClose(Cancel As Boolean)
    > Dim Res As Long
    > Res = MsgBox("Have you...", vbYesNo)
    > Cancel = Res <> 6
    >
    > End Sub
    >
    > This is workbook event code and should be pasted into the workbook's
    > ThisWorkbook module:
    >
    > Right click the Excel icon on the worksheet (or the icon to the left of the
    > File menu if your workbook is maximised) | Select View Code from the
    > resultant menu, and paste the code. Alt-F11 to return to Excel..
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    >
    > "Aardvark" <[email protected]> wrote in message
    > news:[email protected]...
    > > On Excel XP I would like for a message box to come up when exiting a
    > > spreadsheet as a reminder to check certain items. Is this possible?

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1