ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting a menu in BeforeClose but user Cancels the Save (https://www.excelbanter.com/excel-programming/345814-deleting-menu-beforeclose-but-user-cancels-save.html)

LRL

Deleting a menu in BeforeClose but user Cancels the Save
 
I have a custom menu which I delete in the Workbook_BeforeClose subroutine.
If the user cancels the save, the menu is gone but the spreadsheet is still
open.

I need to be able to delete the menu under the conditions that the user goes
ahead and either saves or doesn't save the spreadsheet but closes it, as well
as retaiin or recreate the menu under the condition that he cancels the
save/don't save and keeps the spreadsheet open.

Any ideas?

Thanks

Leslie

Ron de Bruin

Deleting a menu in BeforeClose but user Cancels the Save
 
Hi

Use this two events in the Thisworkbook module.
Read more about events on Chip Pearson's site.

http://www.cpearson.com/excel/events.htm

Private Sub Workbook_Activate()

End Sub

Private Sub Workbook_Deactivate()

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"LRL" wrote in message ...
I have a custom menu which I delete in the Workbook_BeforeClose subroutine.
If the user cancels the save, the menu is gone but the spreadsheet is still
open.

I need to be able to delete the menu under the conditions that the user goes
ahead and either saves or doesn't save the spreadsheet but closes it, as well
as retaiin or recreate the menu under the condition that he cancels the
save/don't save and keeps the spreadsheet open.

Any ideas?

Thanks

Leslie




LRL

Deleting a menu in BeforeClose but user Cancels the Save
 
Hi

Thanks for the information. I placed breakpoints in the Workbook_Activate
and Workbook_Deactivate routines but neither were called after cancelling the
Save dialog. As far as I can tell, neither routine is involved after the Save
dialog is dismissed via the Cancel button.

The _Activate does have a call to my createMenu routine and the _Deactivate
calls my deleteMenu routine.

Is there something I need to do to get the Activate/Deactivate to get called
after the Save dialog is dismissed via the Cancel button?

Thanks


"Ron de Bruin" wrote:

Hi

Use this two events in the Thisworkbook module.
Read more about events on Chip Pearson's site.

http://www.cpearson.com/excel/events.htm

Private Sub Workbook_Activate()

End Sub

Private Sub Workbook_Deactivate()

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"LRL" wrote in message ...
I have a custom menu which I delete in the Workbook_BeforeClose subroutine.
If the user cancels the save, the menu is gone but the spreadsheet is still
open.

I need to be able to delete the menu under the conditions that the user goes
ahead and either saves or doesn't save the spreadsheet but closes it, as well
as retaiin or recreate the menu under the condition that he cancels the
save/don't save and keeps the spreadsheet open.

Any ideas?

Thanks

Leslie






All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com