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 / February 2008

Tip: Looking for answers? Try searching our database.

How to change an MS Word document's template before opening?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alanmurphy@gmail.com - 22 Feb 2008 12:56 GMT
Hi,

Does anybody know how to change an MS Word document's assigned
template, preferably before the document opens? DSOFile.dll can't do
it, and I'm not sure what else that leaves?

Any and all pearls of wisdom welcomed and appreciated,

Cheers,
Al
Jay Freedman - 22 Feb 2008 14:18 GMT
>Hi,
>
[quoted text clipped - 6 lines]
>Cheers,
>Al

It isn't possible to change it without opening the document first.

Once it is open, assign the AttachedTemplate property:

ActiveDocument.AttachedTemplate = "C:\Templates\Letter.dot"

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Tony Jollans - 24 Feb 2008 07:40 GMT
But note that if just the path is changing and the new template name is the
same as the old name, this won't work, and you will need to do it a
different way:

   With Application.Dialogs(wdDialogToolsTemplates)
       .Template = "C:\Templates\Letter.dot"
       .Execute
   End With

Signature

Enjoy,
Tony

>>Hi,
>>
[quoted text clipped - 19 lines]
> Email cannot be acknowledged; please post all follow-ups to the newsgroup
> so all may benefit.
 
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.