View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Cancel "Save Workbook" popup

A different approach.

Check if the workbook is 'dirty'

If Not Activeworkbook.Saved

and is so throw up your own message

ans = MsgBox ("Save the workbook", vbYesNoCancel)

and test if they cancel

If ans - vbCancel Then

don't remove your commandbar, and Cancel the close

Cancel = True

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"RC-" wrote in message
...
I have some code that runs during the Workbook_BeforeClose procedure. I
have a Main Menu menu bar that I want to remove when the user closes the
workbook.

The code works with out problem, but, if the user is prompted to save the
workbook before closing AND Cancel is clicked, the menu is removed but the
workbook is still open, the user then does not have access to the menu
options.

I am trying to figure out a way to invoke code that will rebuild the menu
bar if the user clicks Cancel at the save workbook dialog box.

Does anyone know how to capture the Cancel event of the save workbook
procedure?

TIA
RC-