VBA to select a custom add-in menu item

Chris Davison (VBA)

Board Regular
Joined
Jun 22, 2002
Messages
84
is it easy to code the selection of a menu item ?

I have a couple of custom add-ins that have their own menu items (in fact, it's very similar to what you see with Colo's HTML addin in the menu)

how would I code the selection of "HTML", "Convert Sheet to HTML" that we normally just do with a mouse ?

When I record it with the macro recorder, it doesn't show up at all

many thanks
Chris
:)
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Chris Davison (VBA)

Board Regular
Joined
Jun 22, 2002
Messages
84
On 2002-09-18 01:28, Andrew Poulsom wrote:
You just need to call the procedure assigned to the menu item.

thanks ANdrew, I get "sub or function not defined...."

it's in it's own module, obviously in it's own XLA file seperate from my module in my worksheet file

how do I call a procedure from such a location ?

[these aren't my menu items by the way, they are customised add-ins that come with our accounting package and a lot of the VBA that sits behind them is hidden away from view unfortunately...)

cheers
Chris
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
You may be able to use the Run method like this:

Application.Run "MyAddin.xla"!MySub"

Change what's in quotes to suit.

If you use Tools, References in the VBE to establish a reference to the Add-In you can omit the name qualifier. You can also call it directly unless it's declared as Private.

You can use the Object Browser to find procedures in the Add-In. Select the Add-In in the Project window and activate the Object Browser. Find it in the Libraries dropdown and the Classes and Members will be displayed below.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,483
Messages
5,596,405
Members
414,064
Latest member
Duncthegreat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top