allowing custom captions to "travel with" Word templates....

K

Kevin

Is there a way to create custom captions in such a way that they
"travel with" a Word template? I want to create these captions for an
organization so that when users access a customized template that I
make available on a network drive, they will have these caption and
figure macros available. Caption and figure
macros do not seem to persist in the same way other macros do in
templates. They disappear from the template as invoked by users from
the network drive.

Do I need to do something with MSI, or ....?

Kevin
 
S

Shauna Kelly

Hi Kevin

The short answer is no. But can we clarify some terminology here?

An MSI (MicroSoft Installer) is a package file used to install software on a
machine.

A macro is code written in VBA and accessible in the Visual Basic Editor
through Alt-F11.

A field is a thing written within the text of the document that tells Word
to do something (eg create a table of contents, or increment and display a
number in a sequence). Generally, you can see fields in grey shading if you
do Tools > Options > View and set "Field Shading" to Always. The shading
won't print. You can view the fields' codes using Alt-F9.

A caption is a short description of a table or a figure, eg "Figure 2 Map of
China" or "Table 3 Population of Brooklyn".

Working backwards, within a caption, the text (eg "Population of Brooklyn")
is provided by the user. The number is provided by a SEQ field. And the
first part ("Figure" or "Table") is a Label.

So, are we talking about custom Labels here?

If so, then, no, they are not stored in a template or a document. They are
stored in normal.dot, which is to say they are stored on a per-user basis.
(I seem to remember that this has been fixed in Word 2007.)

The best you can do is write a macro that creates the labels you require on
the user machine and run it whenever a new document is created from the
template or whenever a document based on that template is opened. (To do
that, see http://word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm.) However,
code that mucks with a user's normal.dot is not really a nice thing to do.
Make sure that your code checks the .Saved status of normal.dot and, if it
was .Saved, that your code Saves it.

However, this won't solve the problem if users emailing a document outside
your environment where the template (and its code) are not available.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
K

Kevin

Shauna said:
Hi Kevin

The short answer is no. But can we clarify some terminology here?

An MSI (MicroSoft Installer) is a package file used to install
software on a machine.

A macro is code written in VBA and accessible in the Visual Basic
Editor through Alt-F11.

A field is a thing written within the text of the document that tells
Word to do something (eg create a table of contents, or increment and
display a number in a sequence). Generally, you can see fields in
grey shading if you do Tools > Options > View and set "Field Shading"
to Always. The shading won't print. You can view the fields' codes
using Alt-F9.

A caption is a short description of a table or a figure, eg "Figure 2
Map of China" or "Table 3 Population of Brooklyn".

Working backwards, within a caption, the text (eg "Population of
Brooklyn") is provided by the user. The number is provided by a SEQ
field. And the first part ("Figure" or "Table") is a Label.

So, are we talking about custom Labels here?

If so, then, no, they are not stored in a template or a document.
They are stored in normal.dot, which is to say they are stored on a
per-user basis. (I seem to remember that this has been fixed in Word
2007.)

The best you can do is write a macro that creates the labels you
require on the user machine and run it whenever a new document is
created from the template or whenever a document based on that
template is opened. (To do that, see
http://word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm.) However,
code that mucks with a user's normal.dot is not really a nice thing
to do. Make sure that your code checks the .Saved status of
normal.dot and, if it was .Saved, that your code Saves it.

However, this won't solve the problem if users emailing a document
outside your environment where the template (and its code) are not
available.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word

Thanks for this, Shauna, and sorry for the imprecision in my language.

Question: Let's assume that we dont't want to "muck with normal.dot,"
but can expect users tol employ MYSPECIAL.dot, which we'll tuck away on
a departmental network drive: Can I write a tiny VB.net application
that I can distribute to my users that will modify MYSPECIAL.dot
*after* they've downloaded the template so that they don't have to
manually make the modification? Or Can a .dot actually call an exe? I
don't want busy users to do precise actions they're unfamliar with,
fail, and call for support.

Perhaps I'm still unclear on the concept, and I understand these
solutions all have security implications.

Kevin
 
S

Shauna Kelly

Hi Kevin

Can you tell us exactly what you want the user to be able to do? Eg:
- open an existing document that this user created that used a certain Label
and ... (and what, exactly?)
or
- open an existing document that someone else created that used a certain
Label and ... (and what, exactly?)
or
- create a new document and .... (what?)

And, for the sake of ease in communication, what's the name of the Label you
want to create?

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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