Load and Use Classes from another template

B

Bernhard Mäder

Hi Group

I'm in the process of building a bunch of templates for various use
(report, fax, memo...). Once finished, the templates will be distributed
through local network shares to my co-workers.

Now the different templates have many things that they have in common
(e.g. phone number, address etc.), which I would like to store in a
central place. Also, I'd need some macros in all of the templates, which
I would like to store in a central place, too.

I have thought about using a reference in C:\Documents and
Settings\...\Application Data\Microsoft\Word\STARTUP that points to a
resource .dot file on the network. That file can now hold all the stuff
that needs to be centralized.

So far the resource template gets properly loaded on startup of word,
but I'm unable (or don't know how) to access the information within
(through VBA code in the document template, say on document_new). So,
these are my questions:

1) Is this whole stuff a good idea or should I drop it and "hard-code"
the information into each template?

2) How can I access those classes from within the document template's
VBA code?

Any help greatly appreciated!

Thx,
Bernhard
 
J

Jean-Guy Marcil

Bernhard Mäder was telling us:
Bernhard Mäder nous racontait que :
Hi Group

I'm in the process of building a bunch of templates for various use
(report, fax, memo...). Once finished, the templates will be
distributed through local network shares to my co-workers.

Now the different templates have many things that they have in common
(e.g. phone number, address etc.), which I would like to store in a
central place. Also, I'd need some macros in all of the templates,
which I would like to store in a central place, too.

I have thought about using a reference in C:\Documents and
Settings\...\Application Data\Microsoft\Word\STARTUP that points to a
resource .dot file on the network. That file can now hold all the
stuff that needs to be centralized.

So far the resource template gets properly loaded on startup of word,
but I'm unable (or don't know how) to access the information within
(through VBA code in the document template, say on document_new). So,
these are my questions:

1) Is this whole stuff a good idea or should I drop it and "hard-code"
the information into each template?

Yes, that is the way to go.
Put the data in AutoText in the global template and all users loading the
global templates will have access to those Autotext entries.
The same with toolbars and associated macros.
2) How can I access those classes from within the document template's
VBA code?

Open a template, in the VBA editor, go to Tools > References... and set a
reference to the global template project. Then you will be able to call all
the public macros in the global template by using Intellisense (Type the
global project name, then a "." and you will get a list of all the available
modules, choose a module and type another "." to get the list of available
macros in the module).

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Bernhard Mäder

Jean-Guy Marcil said:
Bernhard Mäder was telling us:
Bernhard Mäder nous racontait que :




Yes, that is the way to go.
Put the data in AutoText in the global template and all users loading the
global templates will have access to those Autotext entries.
The same with toolbars and associated macros.




Open a template, in the VBA editor, go to Tools > References... and set a
reference to the global template project. Then you will be able to call all
the public macros in the global template by using Intellisense (Type the
global project name, then a "." and you will get a list of all the available
modules, choose a module and type another "." to get the list of available
macros in the module).


Aah, yes, thank you!

I'm still not sure if this is going to be good, though. Since this
either requires the user to have access to the network every time the
VBA accesses the resources, or copy the resource file to his local
machine, which makes updating difficult.

Thanks,
Bernhard
 
J

Jean-Guy Marcil

Bernhard Mäder was telling us:
Bernhard Mäder nous racontait que :
Aah, yes, thank you!

I'm still not sure if this is going to be good, though. Since this
either requires the user to have access to the network every time the
VBA accesses the resources, or copy the resource file to his local
machine, which makes updating difficult.

You can have a simple script that runs when a user logs on to the network.
The script checks whether the local global template has a modified date
that is older than the one on the network, if so, it gets updated.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Bernhard Mäder

Jean-Guy Marcil said:
Bernhard Mäder was telling us:
Bernhard Mäder nous racontait que :




You can have a simple script that runs when a user logs on to the network.
The script checks whether the local global template has a modified date
that is older than the one on the network, if so, it gets updated.

Yes, that might be the best solution, thanks for the hint!

Bernhard
 

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