Results 1 to 2 of 2
Thread: Setting Menu NAmes in VBA
2001-05-20, 12:29 #1jkzGuest
Setting Menu NAmes in VBA
Anyone know how to do this? If you record adding a new menu you get the following lines of VBA:
CommandBars("Menu Bar").Controls.Add _
Actually I added the Temporary tag myself, but it is still a legal bit of code. What I can't record is setting the name of the menu, from "New Menu" to whatever...
Also, the controlBars object doesn't seem to have a Name method. Arrghh!
It must be here some where, can anyone point me in the right direction?
2001-05-21, 16:56 #2
- Join Date
- May 2001
- the Netherlands
- Thanked 0 Times in 0 Posts
Re: Setting Menu NAmes in VBA
Try using "Caption". An example:
Dim menu As CommandBarControl
Dim item As CommandBarButton
Set menu = CommandBars("Standard").Controls.Add (Type:=msoControlPopUp, Before:=23)
menu.Caption = "NameOfYourMenu"
Set item = menu.Controls.Add(Type:=msoControlButton)
.Caption = "Name"
.Style = msoButtonCaption
To get an accelerator put an ampersand in front of the character you want to use (e.g. "&Name").