Can I call a command bar button from a command bar control?

C

Chris H

Hello All,

I have an issue where I want to add my own menu items in Word but I need it to execute a function in a Word Addin.

Well, I can do anything I need by creating a CommandBarButton but I cannot get to events from the Menu(Command Bar Control).

So is there a way I can make the code in the command bar button execute if I click on my custom menu item?

Note: I am not using VBA at all, so I cannot call a VBA macro.... This is the common method from the internet....

Ex..

Private m_Save_As_Menu_Option As Office.CommandBarControl

some other code to create the menu.....

m_Save_As_Menu_Option.OnAction = "Click/Execute Command Bar Item(546347)"

According to a microsoft Q document, i have to add a custom class to trap the click events of the menu item.... It's weird that the menu items don't work the same.

Thanks in advance,
Chris H
 
C

Chris H

Hi Bill,

I can get CommandBarButtons working fine in my custom Addin dll.

I just can't use my own inserted menu item under let say "&File" for
microsoft word. I can put it there when the addin is initialized but I can't
do anything with it.

I have trouble capturing this event in VB. Withevents does not exist for
CommandBarControl's

Or to put things simpler, how can I know what the user clicked on in a Word
menu through code.

Hope this email is clearer... :~>

C
 

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

Top