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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a Word template from macro 1

Status
Not open for further replies.

BJ1106

Programmer
Aug 24, 2006
30
US
Hi,

I have 2 word templates: temp1.dot and temp2.dot. then i wrote a macro in a word file which will either open temp1.dot or temp2.dot depending on the differetn input user entered. well, i have a hard time to run the templates. when double click on the template, it will open as a regular document with .doc extention. but when i tried to call and open it from the macro, it opened as .dot. can someone help?

thanks a lot
 
it opened as .dot
Don't use the Open but the Add method of the Documents object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
As in:
Code:
Documents.Add Template:="c:\test\testbutton.dot"
This will create a new document based on on the template testbutton.dot.

NOTE: the file location used for this does NOT have to be any of the File Locations for templates in the Word settings. It can be called from any folder.

Gerry
My paintings and sculpture
 
Thank you, Gerry.

It works fine.

Thank you all.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top