Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

'AttachedTemplate'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Let2Editor - 28 Dec 2004 01:45 GMT
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
Klaus Linke - 28 Dec 2004 03:11 GMT
> 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.
Charles Kenyon - 28 Dec 2004 03:26 GMT
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.

Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

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

See also the MVP FAQ: 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.

> If there are 2 or 3 xxxxx.dot files in my startup directory (add-ins),
> plus the
[quoted text clipped - 15 lines]
>
> Thanks, Ed
Klaus Linke - 28 Dec 2004 06:37 GMT
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

> 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
[quoted text clipped - 52 lines]
> >
> > Thanks, Ed
Let2Editor - 28 Dec 2004 11:00 GMT
Klaus and Charles,

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

Ed
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.