![]() |
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? |
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" wrote in message ... 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? |
How to get custom dialog box when exiting Excel Spreadsheet
I tried this and it didn't work. It just gave me an error when re-opened the workbook saying the macros were disabled. :confused -- chriskxp212 ----------------------------------------------------------------------- chriskxp2123's Profile: http://www.excelforum.com/member.php...fo&userid=2583 View this thread: http://www.excelforum.com/showthread.php?threadid=39293 |
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" wrote in message news:chriskxp2123.1t91uu_1123175150.0638@excelforu m-nospam.com... 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. :confused: -- chriskxp2123 ------------------------------------------------------------------------ chriskxp2123's Profile: http://www.excelforum.com/member.php...o&userid=25833 View this thread: http://www.excelforum.com/showthread...hreadid=392933 |
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" wrote in message ... 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? |
All times are GMT +1. The time now is 07:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com