Call an addin command from a macro?

  • Thread starter John in Saratoga
  • Start date
J

John in Saratoga

I have a commercial addin that creates bibliographies (Thomson's EndNote). It
loads a .WLL and adds a group of commands under Tools. It has a .DOT file
that provides a toolbar with the same commands.

Can I call one of these commands from a macro? I tried selecting the command
while recording a macro, but nothing gets recorded.

The commands do not appear under the Commands tab of the Customize dialog.
The toolbar button has an identifying name. Can I use that somehow?

Thanks for any leads.
 
H

Helmut Weber

Hi John,
Thanks for any leads.

_any_?

Then maye something along these lines.

Sub test8790()
Dim oCtrl As CommandBarButton
' testing how to identify the button
For Each oCtrl In CommandBars("Test").Controls
MsgBox oCtrl.TooltipText
MsgBox oCtrl.Caption
MsgBox oCtrl.ID
MsgBox oCtrl.OnAction ' the macro
Next

For Each oCtrl In CommandBars("Test").Controls
If oCtrl.ID = 2823 Then ' for example
oCtrl.Execute
End If
Next
End Sub

Why that all?

Because there seems to be a good deal of confusion
between name (in the user interface), caption (programmatically)
and tooltiptext.

You have to check, whether one of these options
is working for you.

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

John in Saratoga

That works!

I found all the necessary properties and can execute the macros.

I'm curious: Now that I know the name of the macro, can I execute it
directly, without looping through the controls?

Viele Danke,
John
 
H

Helmut Weber

Hi John,

like, but only for the ID,

CommandBars("Test").FindControl(ID:=2823).Execute

can't get to work other properties but ID of the button.

The reason might be:
Someone at MS went home for the superbowl broadcast,
someone at MS poured a cup of coffee
in the keyboard at the wrong time...,

anyway,
that was an interesting question.

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
H

Helmut Weber

It can all be so simple:

just the name of the macro.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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