Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
User Defined type not defined Karpagam Excel Programming 1 May 16th 04 05:41 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 08:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"