D
Dimitri
Hello,
I have te following code to create a menu. In the first item i wanna have
some subitems. Can anyone tell me how to do this?
Sub Menu()
Dim Item As CommandBarControl
CustomizationContext = ActiveDocument.AttachedTemplate
CommandBars("Menu Bar").Controls.Add(msoControlPopup).Caption = "&Test"
With CommandBars("Menu Bar").Controls("Test").Controls
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem1"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem2"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem3"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem4"
Item.OnAction = "TestMacro"
End With
End Sub
Thanks
Dimitri
I have te following code to create a menu. In the first item i wanna have
some subitems. Can anyone tell me how to do this?
Sub Menu()
Dim Item As CommandBarControl
CustomizationContext = ActiveDocument.AttachedTemplate
CommandBars("Menu Bar").Controls.Add(msoControlPopup).Caption = "&Test"
With CommandBars("Menu Bar").Controls("Test").Controls
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem1"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem2"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem3"
Item.OnAction = "TestMacro"
Set Item = .Add(Type:=msoControlButton)
Item.Caption = "MenuItem4"
Item.OnAction = "TestMacro"
End With
End Sub
Thanks
Dimitri