Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5973451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:48:07+00:00 2026-05-22T20:48:07+00:00

I have a workbook where I want to be sure user is really sure

  • 0

I have a workbook where I want to be sure user is really sure he want to quit without saving changes. Is there a way to prompt a message if user click no on XL message “Do you want to save the changes?” on leaving?

I know there is a BeforeSave event but this one is triggered BEFORE the XL prompt and in my case, I would like AFTER.

Example:

- User click the X for leaving the Workbook.
- XL prompt user for saving changes.
- User click NO.
- I would like to prompt again something like "ARE YOU SURE?"

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:48:08+00:00Added an answer on May 22, 2026 at 8:48 pm

    the Workbook_Deactivate event fires after the save dialog is dismissed.

    You will need to show a modal MsgBox and handle the responce, issue Thisworkbook.Save if required

    Private Sub Workbook_Deactivate()
        Dim res As VbMsgBoxResult
        If Not ThisWorkbook.Saved Then
            res = MsgBox("Save Now?", vbYesNo, "Book Not Saved")
            If res = vbYes Then
                ThisWorkbook.Save
            End If
        End If
    End Sub
    

    Has the side effect that if more than one book is open, switching between them can fire the meesage too

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel workbook that I want to use as a template. It
I have a signed Excel workbook and I want to delete the signature from
I have an excel library workbook and want to convert it to a byte[]
I have an Excel workbook which I want to scroll through the contents of
I have a workbook with several sheets with tables on them. I want to
I have data in one sheet in a workbook. I want to distribute it
I have an Excel workbook that utilises a data table (A). I now want
I have a workbook containing multiple sheets of varying sizes. I want to add
I have a workbook that has many checkboxes (form control) on one tab. I
I have a workbook A with a macro and set with a shortcut Ctrl+Q,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.