Excel 2007 Custom Right Click Menus for Connectors and Shapes - Re

J

Joe B.

Reposting - other answers did not address ? (misinterpreted ?)

I get this to work in 2003 but not 2007
context / popup menu works for Cell but not connector or shapes in 2007.
Works in 2003. I understand the ribbon messes up regular menus, but what am
I missing with 2007 right click menus?

I have a more complex version of the code below I intend to use - but I ran
this simple one to see if it would work in 2007 and 2003 (make sure did not
have other code issues).

Sub editconnector()
Dim MenuItem As Object
Dim i, j As Integer

Application.CommandBars("connector").Reset
Application.CommandBars("shapes").Reset
Dim MyMenu As Object
Set MyMenu = Application.CommandBars("connector")
j = MyMenu.Controls.Count
For i = 1 To j
MsgBox (MyMenu.Controls(i).Caption)
Next i
Set MenuItem =
MyMenu.Controls.Add(Type:=msoControlButton, Before:=1, temporary:=False)
MenuItem.BeginGroup = True
MenuItem.OnAction = ThisWorkbook.Name & "!" &
"do_analysis"
MenuItem.Caption = "Tester2"
MenuItem.Visible = True
MsgBox (MenuItem.Caption)

Set MyMenu = Application.CommandBars("shapes")
j = MyMenu.Controls.Count
For i = 1 To j
MsgBox (MyMenu.Controls(i).Caption)
Next i
Set MenuItem = MyMenu.Controls.Add(Type:=msoControlButton)
MenuItem.BeginGroup = True
MenuItem.OnAction = ThisWorkbook.Name & "!" &
"do_analysis"
MenuItem.Caption = "Tester3"
MsgBox (MenuItem.Caption)

End Sub
 

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