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

Arthur Fuller artful at rogers.com
Sun Jun 19 13:23:55 CDT 2005


Thanks, Bryan. So far I'm doing it just by loading the template itself, but
your option looks a bit slicker.

Arthur

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell
Sent: June 19, 2005 10:09 AM
To: Discussion of Hardware and Software issues
Subject: Re: [dba-Tech] Create a Word document from a specified template

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. 


_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list