K
Kent McPherson
I have a menu item added to the Tools menu called MyMenu. I'm trying to tie
it to a VBA subroutine I've written called MySub. I have this code for the
menu.
Application.CommandBars("Worksheet menu
bar").Controls("Tools").Controls.Add(Type:=msoControlButton).Caption =
"MyMenu"
Application.CommandBars("Worksheet menu
bar").Controls("Tools").Controls("MyMenu").OnAction = MySub
Then I created a new module with this code.
Private Sub MySub ()
MsgBox ("My subroutine")
End Sub
When I select the MyMenu command from the Tools menu, nothing happens so I'm
obviously not making the linkage correctly. Any help would be greatly
appreciated.
it to a VBA subroutine I've written called MySub. I have this code for the
menu.
Application.CommandBars("Worksheet menu
bar").Controls("Tools").Controls.Add(Type:=msoControlButton).Caption =
"MyMenu"
Application.CommandBars("Worksheet menu
bar").Controls("Tools").Controls("MyMenu").OnAction = MySub
Then I created a new module with this code.
Private Sub MySub ()
MsgBox ("My subroutine")
End Sub
When I select the MyMenu command from the Tools menu, nothing happens so I'm
obviously not making the linkage correctly. Any help would be greatly
appreciated.