[AccessD] Access form producing a Word document

Paul Rodgers Paul.Rogers at SummitMedia.co.uk
Wed Sep 29 10:01:48 CDT 2004


That looks excellent, Joe. Many, many thanks. All the best
paul

-----Original Message-----
From: Joseph O'Connell [mailto:joconnell at indy.rr.com]
Sent: 29 September 2004 15:31
To: Access Developers discussion and problem solving;
Paul.Rogers at summitmedia.co.uk
Subject: Re: [AccessD] Access form producing a Word document


Paul,

Create a Word document and instead of typing the text that can change,
insert a bookmark using names that are meaningful to you.  Save the
document.

Create a form with 3 text boxes and a command button.  The user will enter
values into each textbox to be inserted into the Word document.  Insert this
code for the Click event of the button (insert your own error handling).

    Dim appWord As Word.Application
    Dim docWord As Word.Document
    Dim strFile as String

    strFile = "insert the complete path to the Word document"

    Set appWord = New Word.Application
    Set docWord = appWord.Documents.Add(strFile)

    docWord.Bookmarks("the name of the first bookmark").Range.Text =
Me!txtField1
    docWord.Bookmarks("the name of the second bookmark").Range.Text =
Me!txtField2
    docWord.Bookmarks("the name of the third bookmark").Range.Text =
Me!txtField3

    appWord.ActiveDocument.PrintOut
    appWord.ActiveDocument.Close

    Set appWord = Nothing
    Set appWord = Nothing
    strFile = ""


Joe O'Connell


-----Original Message-----
From: Paul Rodgers <Paul.Rogers at SummitMedia.co.uk>
To: 'Access Developers discussion and problem solving'
<accessd at databaseadvisors.com>
Date: Wednesday, September 29, 2004 4:43 AM
Subject: [AccessD] Access form producing a Word document


|Can an Access form be coded to print a single Word document in which the
|text is almost always the same, but for about three fields, please?
|
|For example, a command button to produce (for the employee whose form it
is)
|birthday cheers, or a wedding congratulations, or to be fired.
|
|Cheers
|paul
|
|---
|Outgoing mail is certified Virus Free.
|Checked by AVG anti-virus system (http://www.grisoft.com).
|Version: 6.0.767 / Virus Database: 514 - Release Date: 21/09/2004
|
|
|--
|_______________________________________________
|AccessD mailing list
|AccessD at databaseadvisors.com
|http://databaseadvisors.com/mailman/listinfo/accessd
|Website: http://www.databaseadvisors.com


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.767 / Virus Database: 514 - Release Date: 21/09/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.767 / Virus Database: 514 - Release Date: 21/09/2004
 




More information about the AccessD mailing list