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

Re: Create references to template files by Jonathan

Jonathan
Thu Sep 06 02:57:47 CDT 2007


"Lasse" <Lasse@discussions.microsoft.com> wrote in message
news:C0768FB1-63CF-470D-AA79-9F7772027E9D@microsoft.com...
> 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.


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


Re: Create references to template files by Lasse

Lasse
Thu Sep 06 04:38:03 CDT 2007

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?

"Jonathan West" wrote:

>
> "Lasse" <Lasse@discussions.microsoft.com> wrote in message
> news:C0768FB1-63CF-470D-AA79-9F7772027E9D@microsoft.com...
> > 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.
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
>
>

Re: Create references to template files by Jonathan

Jonathan
Fri Sep 07 04:37:11 CDT 2007


"Lasse" <Lasse@discussions.microsoft.com> wrote in message
news:23C89E52-6109-4648-9098-16E5D993222B@microsoft.com...
> 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")


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