LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default New menu item action

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:=msoCont rolButton).Caption =
"MyMenu"
Application.CommandBars("Worksheet menu
bar").Controls("Tools").Controls("MyMenu").OnActio n = 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.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triggering an action when an item is selected from a dropdown menu Xonnel1212 Excel Worksheet Functions 1 July 2nd 09 12:17 AM
Command button to move completed action item JFREE223 Excel Discussion (Misc queries) 4 February 5th 08 06:54 PM
Action Item Worksheet Creation Kevin M[_2_] Excel Worksheet Functions 0 February 26th 07 09:16 PM
Trigger Action when Standard Menu Item Selected? Filibuster Excel Discussion (Misc queries) 2 July 26th 06 12:49 AM
Menu Item Action Changes with "User" accessing file windsurferLA Excel Programming 1 June 15th 05 08:00 PM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"