Hi
You'll need to set a reference to the Word Application, which I assume you
can already do.
But, do you really want to open a template and write text into the template?
My guess is that you want to create a new memo and write text into the new
memo.
The way Word is designed to work is that you create a new document based on
a a template (.dot or .dotm or .dotx file). In the user interface that means
the user clicks the Round Office Pizza Button and then New, and selects the
template.
In code you use Word's Documents collection. With the Documents collection,
in general you *Open* an existing document, but you *Add* a new one.
To open an existing document you can do this (assuming appWord is a
reference to the Word application):
dim oDoc as Word.Document
set oDoc = appWord.Documents.Open(FileName:="myolddocument.doc" )
There are a dozen or so other parameters to the .Open method. Look up VBA
help for full details.
To create a new document you use the .Add method of the .Documents
collection, like this:
dim oDoc as Word.Document
set oDoc = appWord .Documents.Add(Template:="mytemplate.dot")
There are several other parameters of the .Add method, also described in the
VBA help.
Just for the record, this:
set oDoc = appWord .Documents.Add
oDoc.AttachedTemplate = "mytemplate.dot"
is *not* the same as this:
set oDoc = Documents.Add(Template:="mytemplate.dot")
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word