Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

Call an addin command from a macro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John in Saratoga - 05 Mar 2006 19:08 GMT
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.
Helmut Weber - 05 Mar 2006 21:28 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

John in Saratoga - 05 Mar 2006 22:00 GMT
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
Helmut Weber - 05 Mar 2006 22:23 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Helmut Weber - 05 Mar 2006 22:27 GMT
It can all be so simple:

just the name of the macro.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

John in Saratoga - 06 Mar 2006 16:41 GMT
Thanks Helmut.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.