View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Executinh Addin Sub Menu Command

Hi Amir,

Why not call the relevant macro from the addin?

E.g.:

Application.Run ("MyAddin.xla!TheMenuMacro")


---
Regards,
Norman



"Amir" wrote in message
...
Hi,

I'm trying to use VBA to execute a sub menu command which was created by
an addin i've installed.

I know I can execute commands in the main command bar in Excel using
command line like this:

CommandBars("WorkSheet Menu Bar").Controls("Tools").Execute

What I wish to do is to execute a command which is in a sub menu under the
"Tools" menu. The desired button is placed he
"WorkSheet Menu Bar" - "Tools" - "MyAddinCustomMenu" -
"MyAddinCustomSubMenu" - "MyAddinSpecificButton"

By now I've solved that by using Tools - Customize to move that specific
button from the addin sub menu to the Worksheet Menu Bar so that I could
execute it using:
CommandBars("WorkSheet Menu
Bar").Controls("MyAddinSpecificButton").Execute

The problem is that it requires each user to do that customization for the
code to work. I addition it doesn't look proffessional.

How can I execute that button using a code in VBA, without moving it to
the Worksheet menu bar?

Regards,
Amir.