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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,670
Messages
5,838,688
Members
430,563
Latest member
Raeyven

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