Attaching a Template to a document

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I'm using Word 2002, SP-1, on Windows 2000.
I've created a Template and attached it to a document,
then I customized the "Heading" Styles, "Body text"
Styles, and added some custom Styles. I then attempted to
attach my Template to another document so that I could use
the modified Styles and custom Styles in that document,
but when I did the Attach, I don't see the custom Styles
in the "Styles and Formatting" task pane, and
the "Heading" and "Body text" Styles look the same as they
did before I did the Attach. If I select "File >
Properties", I see "Template: MyTemplate.dot" on the
Summary tab, so it looks as if the attach succeeded. Is
there anything else I have to do to make the document
aware that a different Template is now attached? If you
could help, it would be much appreciated.

Chris
 
Hi Chris

As far as the attachment is concerned, in order to bring the template styles
into the document you need to check 'Automatically update document styles'
in the Templates and Add-ins dialog. You should then open the dialog again
and uncheck the box, because leaving it set can cause various problems. Note
that automatically update styles from template isn't completely reliable for
numbered styles, and also that the changes to styles will have no effect on
document text that has been directly formatted, overriding the style.

However, from your description I wonder whether you have in fact saved your
styles in the template. If you are working in a document, as opposed to
having the .dot file open, any changes you make to styles will only affect
the document, unless you also check the 'Update template' box in the Modify
dialog. Again, passing the style back to the template isn't reliable for
numbered styles - I would always set these up in the .dot file itself.

You can also use the Organizer to copy styles between documents and
templates.

The basic concept to remember is that once a document has been 'Newed' from
a template, it has a life of its own, and getting updates from the document
back to the template, or vice versa, requires positive action and may not
give you a complete match. Numbered styles are buggy, and cascaded styles
(styles based on other styles) fall into the 'logical but confusing'
category of Word features.
 
To follow on from what Margaret has said, if you want reliable access to
styles newly added to a template, you would do well to create a new document
based on the template, then use Insert | File or copy all but the last
paragraph and paste to transfer the content of the old document to the new
one. Note that if you use Insert | File, you need to press Enter a couple of
times first; otherwise Word (contrary to all logic) brings the formatting of
the old document into the new one.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Margaret,

Thank you for your well written reply. I tried your
suggestion of checking the 'Automatically update document
styles' checkbox in the Templates and Add-ins dialog box
and it worked like a champ. I had intended to mention
that if I selected "File > New" and then selected
the "MyTemplate" Template, the Styles that I had saved
appeared in the "Styles and Formatting" task pane, but,
being over 50, I forgot to add it at the end of my
description.

As to numbered Styles, I have been on a buggy ride with
them for some time. I'm trying to modify some VBA code
(written by MVP John McGhie), that was referenced on the
Word "Numbering" Newsgroup, to be able to reliably format
the Numbering Styles to my specifications. It involves
bypassing the Numbering Style Gallery positional
referencing, in order to be able to send the document to
someone else, who will probably have that Numbering Style
in a different position in the Gallery. I'm a bit
confounded by the suggestion that anyone trying to use
numbering in Word (a secretary, for example) is expected
to modify a thousand or so lines of VBA code to do it
reliably, whereas, presumably, Microsoft can't supply the
VBA code as part of Word with a dialog box to allow the
user to change it reliably. Am I missing something here?

Thanks again,
Chris
 
Suzanne,

Are you saying that starting with a new document based
on "MyTemplate" and then inserting the text of an existing
document into it is more reliable than opening
the "Templates and Add-Ins" dialog box, checking
the "Automatically update document styles" box, and then
attaching the "MyTemplate" Template? Or is it a way to
keep from having to remember to un-check the box again?

Thanks for your reply,
Chris
 
Hi Chris

Most of the time now (Word 2002 and the latest SRs of 97 and 2000) you will
get on fine if you a) stick to styles and b) set the styles up following
Shauna's detailed instructions in

http://www.shaunakelly.com/word/numbering/OutlineNumbering.html

(lots of other good stuff on this site that may illuminate your template
questions, too).

Personally, I do always set my numbered styles up from VBA, because I have
the code to do it (don't think it's anything like 1000 lines!) and I know it
is reliable, especially when creating styles that may need to be updated
from template. However, once the styles are set up (either way) you
shouldn't have to touch VBA *or* (most important) the Bullets and Numbering
dialog again, as applying the style will apply the correct numbering. The
thing to avoid is applying the numbering directly, especially using the
toolbar buttons.

If you want to see a sample of the code I use, see

http://www.syntagma.demon.co.uk/FAQs/ListRestartFromStyle.htm

(This is for numbered lists, including a dummy restart style, but shows the
general principle for creating the list template and linking levels to
styles.)

I see we share an age group and its symptoms <g>.
 
Margaret,

I came up with the 1000 lines of code by starting at:

http://www.shaunakelly.com/word/numbering/OutlineNumbering.
html

There, I followed the "Word's Numbering Explained" link
near the bottom of the page (in the "Grateful
Acknowledgement" paragraph). There, I followed the
link "How to cure Word's List Numbering with a dose of
VBA" (just above the "Table of Contents"). There, I
followed the link "Resetting numbering not available" (top
of the third paragraph). The seventh posting (by John
McGhie, Sep 6, 2001) has in the neighborhood of 1,600
lines of code. (It turns out I was understating the
number of lines a bit, although there is quite a bit of
repetition due to there being 9 of each of the bullets and
numbering categories.) My comment was less about lines of
code than it was about the large percentage of the user
base that has no programming experience (and is unlikely
to ever do any programming) but may still be required to
use bullets or numbering, reliably, in their documents.

It's a good suggestion to set the Style and not touch it
again, but I am creating documents for other people who
will then open them, perhaps with "Automatically update
document styles" checked in the "Templates and Add-Ins"
dialog box, which will potentially break the numbering
Styles because their Normal.dot may have a
different "ListTemplate" in that position of
the "ListGallery". So I presume that means I need to
supply them a different template file
(e.g., "MyMacros.dot") with a macro for applying the macro
Styles and a button on a toolbar to run it. And if they
want to modify the numbering Styles I need to add code in
the macro to put up a dialog box to allow them to do the
changes (I'm currently reading about "UserForms"). Which
makes me think "Gee, this sounds like something that
Microsoft could do!" Anyway, I digress. I don't use the
toolbar buttons to do numbering (thanks for the warning)
and use Styles for most everything (except for occasional
partial paragraph underlining, bolding, etc.).

I'll take a look at your code sample and see if it gives
me more insight. It's been great to experience the
newsgroups and I'm passing the word (if you'll pardon the
pun). Thanks again,

TTFN,
Chris
 
It certainly means that you need to uncheck "Automatically update document
styles" in your document and template. Generally this should not be checked.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://addbalance.com/usersguide/index.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
Back
Top