View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default How to restore a Custom menu if a user presses Cancel after selcti

Alseikhan,

I should have said that Greg's method is better than my solution. My more
complicated method can be useful if your menus were built in an addin that's
opened with the workbook, but that doesn't seem to apply to what you are
doing.

Doug


"Greg Wilson" wrote in message
...
Typically I add controls to the Worksheet Menu Bar instead of making
custom
toolbars but the same holds for toolbars. I create them programmatically
on
wb_open and make them Temporary. I make them invisible on wb_deactivate
and
visible again on wb_activate. So when the application is closed, they are
deleted since they are Temporary. They are, of course, recreated when the
particular wb is opened.

If the user has more than one wb open then, if they activate a different
wb,
the commandbar is made invisible (wb_deactivate event) so that they cannot
run a macro that's inappropriate for the other wb. They are made visible
again when the user returns to the wb (wb_activate event).

Works fine so far.

Regards,
Greg

"Alseikhan" wrote:


A workbook has the subroutine attached to workbook:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteMenu
End Sub

to delete custom menu before closing the workbook.
However, if a user changes mind and presses Cancel to keep workbook
open, the custom menu is deleted anyway!

How do you solver this problem?

Thank you.
Alseikhan


--
Alseikhan
------------------------------------------------------------------------
Alseikhan's Profile:
http://www.excelforum.com/member.php...o&userid=32364
View this thread:
http://www.excelforum.com/showthread...hreadid=529491