new custom menu

G

greg

Hello,
In office 2003;
If I create a new toolbar. And I have a new menu item on this toolbar.
Can I programatically add or remove items on this menu item?
how can you do that?
thanks
 
D

DMc2007

You can,


Code to add a new Menu Item

Sub MenuCreate()

Dim mnMenu As Object

Set mnMenu = CommandBars("Worksheet Menu
Bar").Controls.Add(Type:=msoControlPopup, before:=5, temporary:=True)

mnMenu.Caption = "Example"

With mnMenu
With .Controls
'the code below adds a button
With .Add(msoControlButton)
.Style = msoButtonIcon
.FaceId = 463
.Caption = "About"
.OnAction = "About"
End With
End With
End With

End Sub

Any problems then let me know
 
G

greg

thanks

DMc2007 said:
You can,


Code to add a new Menu Item

Sub MenuCreate()

Dim mnMenu As Object

Set mnMenu = CommandBars("Worksheet Menu
Bar").Controls.Add(Type:=msoControlPopup, before:=5, temporary:=True)

mnMenu.Caption = "Example"

With mnMenu
With .Controls
'the code below adds a button
With .Add(msoControlButton)
.Style = msoButtonIcon
.FaceId = 463
.Caption = "About"
.OnAction = "About"
End With
End With
End With

End Sub

Any problems then let me know
 

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