User defined menu

  • Thread starter Thread starter Glen Mettler
  • Start date Start date
G

Glen Mettler

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
 
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)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top