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
:)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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
Back
Top