Selecting Menu Item by VBA Code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an add-in which adds its own menu to the Excel program. I need to be
able to select a shortcut menu item by VBA to update the information
displayed on the worksheet. This will automate the update process for the
information (otherwise, will need to manually right-click and select the
menuitem ~20 times).

Thanx in advance.
 
Hi

Application.CommandBars.FindControl(, 30010).Controls("&Google Search").Execute
This example will run a control on the Help menu for example

Post back with the name of your control and where it is if you need more help
For ID numbers see
http://www.rondebruin.com/menuid.htm
 
John,

I would have thought that the best way was to set an object variable to the
men u item when creating it

Set myMenuItem =
Application.Commandbars("Standard").Controls.Add(Type:=msoControlButton,temp
orary:=true)
myMenuItem.Caption = "abc"
etc.

Declare myMenuItem as a global object variable, and you can refer to that
anywhere in the code.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top