ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   new custom menu (https://www.excelbanter.com/excel-programming/406649-new-custom-menu.html)

greg

new custom menu
 
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



DMc2007

new custom menu
 
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, befo=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

"greg" wrote in message
...
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


greg

new custom menu
 
thanks

"DMc2007" wrote in message
...
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, befo=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

"greg" wrote in message
...
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





All times are GMT +1. The time now is 01:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com