toolbar button running a macro in a different document

C

Charlie

Is it possible to set the .OnAction property of a toolbar button to run a
macro in a different Word document that is open? The Document name is "SP
Template" that contains the macro I want to run.
thanks,
ck
 
E

Ed

Hi Charlie,

I don't know whether you can set the onaction property to call a macro
in another document directly (it didn't work for me) but what does
seem possible is to set it to call a macro in the template that houses
the toolbar and have that macro call a macro in the other document.

E.g. somewhere in my toolbar template I have some code like this:

Sub RunThis()

Application.Run MacroName:="MyOtherDocProj.Module1.Test1"

End Sub

I set my control's onaction property to run that sub by executing
something like:

CommandBars("Custom 1").Controls(1).OnAction = "RunThis"

And then my toolbar button can (indirectly) run the macro in the other
doc.

Don't know if this helps.

Cheers.

Ed
 

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