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 / February 2006

Tip: Looking for answers? Try searching our database.

toolbar button running a macro in a different document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Charlie - 13 Feb 2006 20:38 GMT
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
Ed - 14 Feb 2006 19:26 GMT
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

> 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
 
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.