PRoblem with Menu Set up

E

ExcelMonkey

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
 
Z

Zack Barresse

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

Btw, may I ask why you use the Temporary status like you do?
 
E

ExcelMonkey

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?
 
Z

Zack Barresse

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.
 

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

Top