View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default 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?