View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default Before Close event

I'm adding a macro in the Workbook_BeforeClose module to check a specific
sheet in the workbook for data. If there is data, a msgbox is displayed with
a Yes, No, Cancel button.

If the user clicks, "yes", then it will clear the sheet and close the workbook

If the user clicks, "no" it will send the data to a database and close the
workbook

If the user clicks, "cancel", I want the close to stop so the user can
review the data.

I have tried the following code but the workbook still closes.

If MyAnswer = 2 Then End

Any suggestions on how to stop the close process would be greatly
appreciated. Thanks for the help.
--
JT