Opening a word 2000 document based on template other than normal.d

M

Mike

Hi! I built a template Custom.dot.
I built a menu which the users can click to open another specialty document.
I call
Set objDoc = Documents.Open(pstrDocLocation & pstrDocName)

to open a new document. However, the new document is based on the Normal
template rather than Custom.dot template. How can I force new documents to
use other templetes? I can not seem to figure out. I tried

Dim myTemplate As Template
Set myTemplate = ActiveDocument.AttachedTemplate

objDoc.AttachedTemplate = myTemplate

but got error message that I can not replace protected template.
I am not sure what it is or whether I am on thr right track ?

Please let me know what I am doing wrong.

Many Thanks in Advance,
 
C

Chad DeMeyer

Mike,

To create a new document from a template other than Normal.dot:

Set objDoc = Documents.Add Template:=pstrDocLocation & pstrDocName

Regards,
Chad
 
C

Chad DeMeyer

Mike,

In that case, what you were doing was returning a reference to Normal.dot
with

Set myTemplate = ActiveDocument.AttachedTemplate

and then trying to reattach to Normal. Instead, just dispense with the
myTemplate variable and just use the string path and filename to attach to
your template:

ActiveDocument.AttachedTemplate = "C:\My Path\My Template.dot"

Regards,
Chad
 

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