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 / June 2007

Tip: Looking for answers? Try searching our database.

Change the template for an existing document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Raul - 26 Jun 2007 18:08 GMT
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
Lene Fredborg - 26 Jun 2007 18:57 GMT
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
 
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.