+ Reply to Thread
Results 1 to 4 of 4

VBA code to exit workbook with a Pop-up message

  1. #1
    Registered User
    Join Date
    05-12-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post VBA code to exit workbook with a Pop-up message

    Hello,
    I wanted to have a VBA code to get a pop-up message when workbook:
    -Opened
    -Before closing

    I have one VBA code written to open and it is working perfect! as below:

    Please Login or Register  to view this content.
    but for the same workbook i could not get the correct exit VBA code.
    Your's assistance is highly appreciated.


    Regards,
    RT
    Last edited by arlu1201; 05-13-2013 at 12:41 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: VBA code to exit workbook with a Pop-up message

    Private Sub Workbook_BeforeClose(Cancel As Boolean)

  3. #3
    Registered User
    Join Date
    05-12-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: VBA code to exit workbook with a Pop-up message

    Thanks Nathan.

    Infact the exit code also i know as below:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    MsgBox "Bye for now"
    End Sub

    I have pop welcome message created through -} Alt + F11 -} This workbook -} paste pop-up message as "welcome to my file" as stated in my original post.
    Now i am trying to have exit message as well pasted as above to the same XL file and i dont know where to have the above VBA code executed?
    [i.e. Should the exit VBA code be present in "this workbook" in project explorer or any other?, i tried having welcome message and exit message in "This workbook" but throws up an error]

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: VBA code to exit workbook with a Pop-up message

    can you attach your attempt?

+ 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