Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
User defined menu
I have a user defined menu. Most of the main options have sub-options. I
want to make the caption of one of the sub-options dynamic so that it changes based on a value. In this case I need to toggle EnableEvents on and off. The sub-menu option of "Utilities" is "Events Enabled" (or "Events Disabled"). I already have a macro to enable/disable the Events. What I need now is a way to dynamically change the caption on the sub-menu. so that it reads "Events Enabled" or "Events Disabled" as the case may be. Is that possible? Glen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
User defined menu
Glen,
Application.Commandbars("Worksheet Menu Bar").Controls("Utilities").Controls("Events Enabled").Caption ="Events Disabled") This is assuming the menu is on the Worksheet Menu Bar, not hanging off of one of the controls. You should be able to deduce the rest -- HTH RP (remove nothere from the email address if mailing direct) "Glen Mettler" wrote in message ... I have a user defined menu. Most of the main options have sub-options. I want to make the caption of one of the sub-options dynamic so that it changes based on a value. In this case I need to toggle EnableEvents on and off. The sub-menu option of "Utilities" is "Events Enabled" (or "Events Disabled"). I already have a macro to enable/disable the Events. What I need now is a way to dynamically change the caption on the sub-menu. so that it reads "Events Enabled" or "Events Disabled" as the case may be. Is that possible? Glen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
User defined menu
Bob,
Thanks for the input. I noodled it a different way. Here is what I did: In the "create menu" code, I have: With .Add(msoControlButton) .Caption = "Events Enabled" .OnAction = "EventsEnableToggle" End With Sub EventsEnableToggle() If Application.EnableEvents = False Then Application.EnableEvents = True Application.CommandBars.ActionControl.Caption = "Events Enabled" Else Application.EnableEvents = False Application.CommandBars.ActionControl.Caption = "Events Disabled" End If End Sub This menu option is only visible to the developer and it works just fine. Thanks again, Glen "Bob Phillips" wrote in message ... Glen, Application.Commandbars("Worksheet Menu Bar").Controls("Utilities").Controls("Events Enabled").Caption ="Events Disabled") This is assuming the menu is on the Worksheet Menu Bar, not hanging off of one of the controls. You should be able to deduce the rest -- HTH RP (remove nothere from the email address if mailing direct) "Glen Mettler" wrote in message ... I have a user defined menu. Most of the main options have sub-options. I want to make the caption of one of the sub-options dynamic so that it changes based on a value. In this case I need to toggle EnableEvents on and off. The sub-menu option of "Utilities" is "Events Enabled" (or "Events Disabled"). I already have a macro to enable/disable the Events. What I need now is a way to dynamically change the caption on the sub-menu. so that it reads "Events Enabled" or "Events Disabled" as the case may be. Is that possible? Glen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
Workspace faux user-defined type not defined | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
User Defined type not defined | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming |