Attaching Normal.dot as Document Template

B

Bob

I'd like to include some code in a macro that makes sure the active
document's attached template is Normal.dot. When emailed (as attachments)
Word docs have uncommon templates attached to them, it seems the recipient's
computer can take many minutes to open the doc, presumably because the
computer is searching the computer/network for the uncommon template to
attach to the document. I don't know for a fact that this is what's
happening, but I do know that the same doc with Normal.dot attached instead
of an uncommon template opens on the recipient's computers in seconds
instead of minutes.

The documents that the macro will modify are edited by different users on
different computers with versions of Word ranging from Word 97 to Word 2003.
My primary concern is that email recipients of these docs who are not in our
organization are able to open the docs without an unnecessary wait. Because
these documents are edited rather than created as new, users/editors
occasionally receive documents with an uncommon template attached by the
creator of the document. I define an uncommon template as any template not
commonly available to the people outside of our organiztion who receive
these docs.

I understand the code will probalby involve
<Options.DefaultFilePath(wdUserTemplatesPath)>, but I'm not sure of the code
specifics. Thanks in advance for any assistance.

Bob
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Bob > écrivait :
In this message, < Bob > wrote:

|| I'd like to include some code in a macro that makes sure the active
|| document's attached template is Normal.dot. When emailed (as attachments)
|| Word docs have uncommon templates attached to them, it seems the
recipient's
|| computer can take many minutes to open the doc, presumably because the
|| computer is searching the computer/network for the uncommon template to
|| attach to the document. I don't know for a fact that this is what's
|| happening, but I do know that the same doc with Normal.dot attached
instead
|| of an uncommon template opens on the recipient's computers in seconds
|| instead of minutes.
||
|| The documents that the macro will modify are edited by different users on
|| different computers with versions of Word ranging from Word 97 to Word
2003.
|| My primary concern is that email recipients of these docs who are not in
our
|| organization are able to open the docs without an unnecessary wait.
Because
|| these documents are edited rather than created as new, users/editors
|| occasionally receive documents with an uncommon template attached by the
|| creator of the document. I define an uncommon template as any template
not
|| commonly available to the people outside of our organiztion who receive
|| these docs.
||
|| I understand the code will probalby involve
|| <Options.DefaultFilePath(wdUserTemplatesPath)>, but I'm not sure of the
code
|| specifics. Thanks in advance for any assistance.

The easiest way out, without code, would be to make a copy of the document
you want to send, then manually attach that one to Normal.dot (Tools >
Templates and Add-ins)... no?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
P

Peter Hewett

Hi Bob

To change the active documents attached template to Normal.dot, you can use this:

ActiveDocument.AttachedTemplate = NormalTemplate

If you are running the above code from your template, it will stop executing after the
above statement. So make sure it's the last thing your template does!

HTH + Cheers - Peter
 
P

Peter Hewett

Hi Charles Kenyon

Follow up on the "Chip Orange" thread as to why it keeps running. As I explained there
are certain circumstances where it might (I say might purely because I have not had the
time to work through all the scenarios I can posit). But specific conditions need to be
met. Also, this behavior may change with any new service pack or new version of Word.

I would not use it in any commercial code I shipped.

Cheers - Peter


A correction, it should stop operating. On my system it does not.

HTH + Cheers - Peter
 
C

Charles Kenyon

I would not use it in any commercial code I shipped.

Nor would I. But it does work that way in Word 97 and Word 2003 (haven't
tested in between)

None of the conditions you listed are met.

The code is in template A which is the attached template for Doc1.
The code in template A attaches template B to Doc1.
The code in template A then creates an instance of a userform (defined in
template A) and displays that userform.
The code in template A then displays a message box.

Checking at the end of this, the attached template for Doc1 is template B.

There is no other document based on template A open. Template A is not
loaded as an Add-In.

Template A was created from Template B using SaveAs.

I'm not saying it should work this way, just that it does. I'll be happy to
send you the templates so you can test it yourself.
 
B

Bob

Jean-Guy,

Thanks for your suggestion. My experience is that users of this template
more often than not forget (or won't bother) to make sure Normal.dot is the
attached template. That's the reason for adding it to a macro that users are
all ready in the habit of running. I hope that answers your question.

Bob
 
B

Bob

Thank you, Jezebel. Your suggestion seems to work perfectly, as does Peter
Hewett's similar suggestion:

ActiveDocument.AttachedTemplate = NormalTemplate

Everyone's help is much appreciated.

Bob
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Bob > écrivait :
In this message, < Bob > wrote:

|| Jean-Guy,
||
|| Thanks for your suggestion. My experience is that users of this template
|| more often than not forget (or won't bother) to make sure Normal.dot is
the
|| attached template. That's the reason for adding it to a macro that users
are
|| all ready in the habit of running. I hope that answers your question.
||
|| Bob
||

You are absolutely right... You do need a macro. I did not catch on to the
fact that the document was used (and sent by email) by many users.... I
thought you were the only one using it.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
B

Bob

Thank you, Peter. I'm particularly grateful for your suggestion to make sure
your suggested code is the last item in my macro when running the macro from
the template. Template users will have access to the template and macro as a
global template and wouldn't seem effected by where the suggested code is
placed in the macro. But I frequently run the macro from the template when
troubleshooting and testing, and I'm not so sure I would have figured out in
a hurry why the macro stopped running at the suggested code. With 20/20
hindsight it seems perfectly logical. Thanks again.

Bob Dukes
 
B

Bob

Thanks, Charles. On my system the macro stops operating when I run it from
the template that includes the macro. When the template is added as a global
template and the macro is run from a template toolbar, it doesn't seem to
matter if the code runs last.

Bob
 

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