[dba-Tech] Create a Word document from a specified template

Bryan Carbonnell carbonnb at sympatico.ca
Sun Jun 19 09:09:04 CDT 2005


On 19 Jun 2005 at 8:41, Arthur Fuller wrote:

> >From within my Access application, I want to run Word and create a
> >new
> document based on a particular template. I suppose I could just open
> the template itself, but I wondered if there is another way to do
> this.

There sure is.

Sub NewDocBasedOnTemplate()

Dim objWord As Word.Application
Dim doc As Word.Document

Set objWord = GetObject(, "Word.Application")
objWord.Visible = True

Set doc = objWord.Documents.Add("full\path\to\tempate.dot", , , True)

'Do your stuff here

Set doc = Nothing
Set objWord = Nothing

End Sub



-- 
Bryan Carbonnell - carbonnb at sympatico.ca
Some mistakes are too much fun to make only once. 





More information about the dba-Tech mailing list