![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 02:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com