I need to change the template for a number of existing documents. Can anyone
tell me how to programmatically change the document template from normal.dot
to newtemplate.dot and then save the document (i.e., overwrite the original
file)?
I have tried unsuccessfully to do this manually.
Thanks in advance,
Raul
To attach the new template to the active document and save the document (you
need to specify the full path to newtemplate.dot):
With ActiveDocument
'Replace "C:\Templates\" below with the correct path
.AttachedTemplate = "C:\Templates\newtemplate.dot"
.Save
End With

Signature
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
> I need to change the template for a number of existing documents. Can anyone
> tell me how to programmatically change the document template from normal.dot
[quoted text clipped - 5 lines]
> Thanks in advance,
> Raul
Raul - 26 Jun 2007 20:49 GMT
Thank you Lene.
The new template (newtemplate.dot) has headers and footers. When I looked
at the active document after I ran the code I did not see the expected
headers and footers. What am I missing?
Thanks,
Raul
> To attach the new template to the active document and save the document (you
> need to specify the full path to newtemplate.dot):
[quoted text clipped - 14 lines]
> > Thanks in advance,
> > Raul
Lene Fredborg - 26 Jun 2007 21:45 GMT
Attaching another template to an _existing_ document will not change the
content of the document. So headers and footers of the new template will not
be transferred to the document. See this article for an explanation:
http://www.shaunakelly.com/word/attachtemplate/index.html

Signature
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
> Thank you Lene.
>
[quoted text clipped - 23 lines]
> > > Thanks in advance,
> > > Raul
Raul - 26 Jun 2007 22:00 GMT
I really appreciate your help and the explanation.
Thanks again,
Raul
> Attaching another template to an _existing_ document will not change the
> content of the document. So headers and footers of the new template will not
[quoted text clipped - 28 lines]
> > > > Thanks in advance,
> > > > Raul