Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word template trouble 1

Status
Not open for further replies.

Sashanan

Programmer
Jan 19, 2001
235
NL
In a VB6 application I am trying to open a Word template (.dot file). I'm using the same code for this that I'm using to open standard Word (.doc) files, namely:

Dim wrdapp As Word.Application
Set wrdapp = CreateObject("Word.application")
wrdapp.Documents.Open &quot;<directory>&quot; & &quot;<filename>.dot&quot;

Now this code works fine if I use it to open a .doc file, but I do not get the desired result with a .dot. What I want it to do is the same thing that happens if I open a .dot from Windows Explorer: namely, create a new document based on this .dot. What actually happens is that the file is opened as a template, allowing me to make changes to the template but not to base a new document on it.

Is there anything I should change about my code so that the same effect is achieved that double-clicking a .dot from Windows Explorer would have?

For the record, the Word versions involved are Word 97 and Word 2000 (differs per client system), but for .docs at least, my current code works with either.

Thanks in advance!
&quot;Much that I bound, I could not free. Much that I freed returned to me.&quot;
(Lee Wilson Dodd)
 
Code:
wrdapp.Documents.Add &quot;<directory>&quot; & &quot;<filename>.dot&quot;

Jordi Reineman
 
Thanks a lot, that did the trick. Can't believe such a simple thing had me stumped for so long! :)
&quot;Much that I bound, I could not free. Much that I freed returned to me.&quot;
(Lee Wilson Dodd)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top