Create references to template files

L

Lasse

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
 
J

Jonathan West

Lasse said:
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?

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

Lasse

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?
 
J

Jonathan West

Lasse said:
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?


Try something like this

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

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