On Exit Dialog Box

Smurfit-Stone

Active Member
Joined
Dec 1, 2004
Messages
485
Hello Board,

I would like to have an dialog box pop up for users asking them if they have archived data in the worksheet before closing/exiting or saving. I've tried looking for something in the (This workbook) section of visual basic, but I can't find anything. Your help would be greatly appreciated. Thanks in advance
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
In the Developer tab, choose Visual Basic. In the left-hand navigation pane, double-click "ThisWorkbook". In the right hand window, at top left, change "(General)" to "Workbook" - you'll get a Workbook_Open event generated. At top right, choose "BeforeClose" and then "BeforeSave". If you want your code to run before the workbook is closed and before the workbook is saved, create a subroutine and call it from both events. Note that "BeforeClose" will run if Excel is exited with your workbook open. Note also that Excel's default handling of open+modified workbooks will mean that you could end up asking the user twice, so plan to test a few scenarios.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top