Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I would like a message box to apear when the user closes the workbook that
would remind them to check certain things in the department before they save. Can anyone help me with the code for this? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi KC,
Try: '================ Private Sub Workbook_BeforeClose(Cancel As Boolean) MsgBox "Your message" End Sub '<<================ This is workbook event code and should be pasted into the workbook's ThisWorkbook module *not* a standard module or a sheet 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 menu and paste the code. Alt-F11 to return to Excel. ****************************************** --- Regards, Norman "kcdonaldson" wrote in message ... I would like a message box to apear when the user closes the workbook that would remind them to check certain things in the department before they save. Can anyone help me with the code for this? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi KC,
Replace my code with the following: '============= Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim res As Long res = MsgBox(prompt:="Have you forgotten to...", _ Buttons:=vbYesNo) Cancel = res = vbYes End Sub '<<============= Now, if the user responds yes to the message box, the file will remain open; otherwise, the file closes. --- Regards, Norman "Norman Jones" wrote in message ... Hi KC, Try: '================ Private Sub Workbook_BeforeClose(Cancel As Boolean) MsgBox "Your message" End Sub '<<================ This is workbook event code and should be pasted into the workbook's ThisWorkbook module *not* a standard module or a sheet 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 menu and paste the code. Alt-F11 to return to Excel. ****************************************** --- Regards, Norman "kcdonaldson" wrote in message ... I would like a message box to apear when the user closes the workbook that would remind them to check certain things in the department before they save. Can anyone help me with the code for this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why excel close all files when I just want to close one files | Excel Discussion (Misc queries) | |||
close button does not close | Excel Discussion (Misc queries) | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
BLANK EXCEL PAGE STILL EXIST AFTER I CLOSE OUT SPREADSHEET? | New Users to Excel | |||
How can I close only 1 workbook when I have many open? | Excel Discussion (Misc queries) |