PRoblem with Menu Set up

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a xla menu that I am trying to set up upon start up. It is failing
ont the line of code:

Set MySubMenu1 = MyMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)

If I change the "msoControlButton" to "msoControlPopup" it works. Problem
is the menue item has little black arrow implying there are sub menus.
Since there aren't, I do no want to show the black arrows. I have used
msoControlButton before and it worked. Is it failing because of the way I
have dimeneioned MySubMenu1?

Sub MenuSetup()
Dim GTMenuBar As CommandBar
Dim MyMenu
Dim MySubMenu1 As CommandBarPopup
Dim MyControl As CommandBarButton
Dim MyButton As CommandBarButton


Set GTMenuBar = CommandBars.ActiveMenuBar

Set MyMenu = GTMenuBar.Controls.Add(Type:=msoControlPopup, Temporary:=True)
MyMenu.Caption = "&PF Tools"
'MyMenu.BeginGroup = True

'******
'Create First Menu Item
Set MySubMenu1 = MyMenu.Controls.Add(Type:=msoControlButton, ID:=1,
Temporary:=True)
MySubMenu1.Caption = "My Program"
MySubMenu1.OnAction = "BigCode"


Thanks
 
Thanks for sharing the solution! Others will benefit from it.

Btw, may I ask why you use the Temporary status like you do?
 
What do you mean by temporary status?

Zack Barresse said:
Thanks for sharing the solution! Others will benefit from it.

Btw, may I ask why you use the Temporary status like you do?
 
In your code, you have your Commandbar [Popup] Temporary status set to True.
It's Boolean, either True or False. ...

Set MySubMenu1 = MyMenu.Controls.Add(type:=msoControlButton, ID:=1,
Temporary:=True)

I was just curious as to the reason you had it set to True.
 
Back
Top