'AttachedTemplate'

L

Let2Editor

If there are 2 or 3 xxxxx.dot files in my startup directory (add-ins), plus the
'normal.dot' in the template directory, which one is the 'attached template'
for purposes of operations like reassigning in VBA macro keyboard commands?
(e.g., 'CustomizationContext = ActiveDocument.AttachedTemplate').

Can the AttachedTemplate ever be an add-in? Can it never be an add-in?

Add the following twist: the user calls for a 'New' document via the 'Files'
menu and selects a document from the Templates listing. It seems pretty obvious
that in that case the 'attached template' is the one selected for the new
document, but the operation of the 'CustomizationContext =
ActiveDocument.AttachedTemplate' doesn't always seem to bear that out.

Thanks, Ed
 
K

Klaus Linke

Let2Editor said:
If there are 2 or 3 xxxxx.dot files in my startup directory (add-ins),
plus the 'normal.dot' in the template directory, which one is the
'attached template' for purposes of operations like reassigning in VBA
macro keyboard commands?
(e.g., 'CustomizationContext = ActiveDocument.AttachedTemplate').

Usually neither...

The attached template usually is the template you based your document on (as you
say further down), or the template you may have attached to the document later
on in "Tools > Templates and Add-ins", or "Normal.dot" if Word couldn't locate
the original attached template.
Can the AttachedTemplate ever be an add-in?

Not as far as I'm aware of, no. But see below.
Add the following twist: the user calls for a 'New' document via the 'Files'
menu and selects a document from the Templates listing. It seems pretty
obvious that in that case the 'attached template' is the one selected for the
new document, but the operation of the 'CustomizationContext =
ActiveDocument.AttachedTemplate' doesn't always seem to bear that out.

Why do you think so? What's the problem you try to solve?

Word comes with lots of built-in, pre-defined keyboard shortcuts (= "application
layer" customizations). Then it loads add-ins, then global templates in the
startup folder(s) (alphabetically from "Z" to "A"), then Normal.dot, then the
attached template, and finally customizations made in the document itself.

If you define custom keyboard shortcuts in the attached template, they always
take precedence over similar shortcuts defined in some global template, or even
Normal.dot, and could in principle only be overridden by shortcuts you define in
the document itself (where you usually would seldom define any).

I think programmers of (COM-)Add-Ins may have figured out ways around this
"natural order of things"... at least I seem to remember that some add-ins can
mess with custom shortcuts, even though you wouldn't expect it from what has
been said.

The texts from the Office Ressource Kit for Word97 unfortunately aren't
available for reading online any more. It was the only official source on how
Word resolves conflicts.
The relevant sub-chapter from the ORK97 is quoted below.
To download all of it: http://office.microsoft.com/en-us/FX011511541033.aspx

Regards,
Klaus


~~~~~~~~~~~~~~~~~~~~~
How Word Resolves Conflicts
In the discussion of templates earlier in this chapter, you may have
noticed that more than one template can affect the working environment of a
document. Each document has access to macros, AutoText entries, and custom
commands and toolbar settings in the attached template, the Normal template, and
any global templates. These templates, as well as add­ins or the Word
application itself, may define a macro or setting in a way that differs from the
other templates or add­ins associated with the document.

The definition or setting that takes precedence is the one that resides
closest to the document. Therefore, Word resolves such conflicts in the
following order of priority:



1.. Template attached to the active document

2.. Normal template

3.. Additional global templates

4.. Add­ins

5.. Application layer

If several global templates have conflicting settings, Word resolves the
conflicts in the order in which the templates are listed in the Templates and
Add­Ins dialog box (Tools menu). Templates in the Word Startup folder appear at
the top of the list and have a higher priority. Subsequent ranking on the list
is determined by alphabetic order.
 
C

Charles Kenyon

An Add-In _can_ be the attached template but this is bizarre. Normally
Add-Ins are stored in the StartUp folder while attached templates are stored
in the user templates or workgroup templates folder. The StartUp folder
should never be in one of these other two folders. You _can_ double-click on
an Add-In template in Windows and create a new document based on that
template; in that case, it is the attached template. You _can_ use vba
commands to attach an Add-In to your document. I emphasize _can_ because I
cannot think of a good reason to do this. Add-In or global templates serve
very different purposes from document templates.

If you don't use templates but start from a blank document, you are using
the normal.dot template as your attached template. The normal.dot template
is a global template.

For more on the different kinds of templates, tabs on the file new dialog,
and locations of templates folders see
http://addbalance.com/usersguide/templates.htm. See
http://addbalance.com/word/movetotemplate.htm for step-by-step instructions
on moving / sharing / copying / backing-up customizations including
AutoText, AutoCorrect, keyboard assignments, toolbars, macros, etc. This is
basic instruction on creating a global or Add-In template.
 
K

Klaus Linke

Hi Charles,

I guess I'd differentiate between add-ins (*.wll or *.dll files) and global
templates.
But still, as you say, you'd usually not attach a document to a global template.

By the way, the info on how Word resolves conflicts is still available from
Microsoft, though only on MSDN rather than Office support:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnword2k2/html/
odc_wdtemp.asp "The Hierarchy of Templates"
(Author: Charles Kyle Kenyon ... Thanks -- great job!!)

Regards,
Klaus
 
L

Let2Editor

Klaus and Charles,

Wow! Thanks. This is real food for thought, and it has answered all of my q's.

Ed
 

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