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 / September 2007

Tip: Looking for answers? Try searching our database.

Create references to template files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lasse - 06 Sep 2007 08:28 GMT
Hi

We currently have a template (add-in) that runs when Word starts. It creates
some new menus and shortcuts to other templates. A lot of our templates
contain a AutoNew macro which does the same in all the templates. I would
like to insert the AutoNew code in one template file and the call the code
from all the other files.
The only way I can see how to make a reference is in the Visual Basic editor
under Tools -> References. But it seems to be a static reference I create,
and I want to place the template containing all the macros in each users
folder.
The big question is....... Is there another way to create the references,
i.e. with a function?

Best regards
Lasse
Jonathan West - 06 Sep 2007 08:57 GMT
> Hi
>
[quoted text clipped - 11 lines]
> The big question is....... Is there another way to create the references,
> i.e. with a function?

Instead of using a reference, call the routine in the other template using
the Application.Run method.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

Lasse - 06 Sep 2007 10:38 GMT
Hi Jonathan

Thanks for the quick reply.

When I use Application.Run I can only get it to run subs not functions as
long as the template file isn't added as a static reference.

Can I insert the functions as parameters to the application.run?

> > Hi
> >
[quoted text clipped - 14 lines]
> Instead of using a reference, call the routine in the other template using
> the Application.Run method.
Jonathan West - 07 Sep 2007 10:37 GMT
> Hi Jonathan
>
[quoted text clipped - 4 lines]
>
> Can I insert the functions as parameters to the application.run?

Try something like this

x = Application.Run("myMacro", "My first parameter")

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

 
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.