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 addins or the Word
application itself, may define a macro or setting in a way that differs from the
other templates or addins 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.. Addins
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
AddIns 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.