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

A

alanmurphy

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
 
J

Jay Freedman

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

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"
 
T

Tony Jollans

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
 

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