OK I know know that you were setting up a shortcut menu - apologies for not
knowing that befo
Option Explicit
Sub popup()
Dim MyBar As CommandBar, MyItim1 As CommandBarControl, MyItim2 As
CommandBarControl
Dim MyItim3 As CommandBarControl, MyItim4 As CommandBarControl
Set MyBar = CommandBars.Add(Name:="Shtmenu", Position:=msoBarPopup,
Temporary:=True)
Set MyItim1 = MyBar.Controls.Add(Type:=msoControlButton)
With MyItim1
.Caption = "Show"
.OnAction = "Macro1"
End With
Set MyItim2 = MyBar.Controls.Add(Type:=msoControlPopup)
With MyItim2
.Caption = "Show2"
'.OnAction = "Macro2"
End With
Set MyItim3 = MyItim2.Controls.Add(Type:=msoControlButton)
With MyItim3
.Caption = "Show3"
.OnAction = "Macro3"
End With
Set MyItim4 = MyItim2.Controls.Add(Type:=msoControlButton)
With MyItim4
.Caption = "Show4"
.OnAction = "Macro4"
End With
MyBar.ShowPopup 200, 200
End Sub
Sub DelBars()
Dim bar As CommandBar
For Each bar In Application.CommandBars
If Not bar.BuiltIn Then bar.Delete
Next
End Sub
"kalle" wrote in message
...
Hi
How do I add a submenu to this?
Dim MyBar As CommandBar, MyItim As CommandBarControl
Set MyBar = CommandBars.Add(Name:="Sheet1menu", Position:=msoBarPopup,
Temporary:=True)
Set MyItim = MyBar.Controls.Add(Type:=msoControlButton)
With MyItim
.Caption = "Show"
.OnAction = "Macro1"
End With
Set MyItim = MyBar.Controls.Add(Type:=msoControlButton)
With MyItim
.Caption = "Show2"
.OnAction = "Macro2"
End With
This works fine but I want t ohave a submenu to the first one.
Thanks in advance
*** Sent via Developersdex http://www.developersdex.com ***