add names from database into a form letter using word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

how can I add names in a form letter in word from the names contained in my
database of names?
 
First, go to Word Help file and look up how to create and use templates.
Then see below my signature line.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you don't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.
Remember that a lone man built the Ark. A large group of professionals built
the Titanic.

From my file ---------
Creating a form letter with data from Access



1.. Create a Word template for the form letter. In the template use the
Insert -
Bookmark command to create a bookmark at each location in the text where
you'll want to insert Access data.
Example: the Word template name is C:\FormLetter.dot. For this example,
I'm using simple Name and Address fields, so you should create a bookmark
named FirstName and another named LastName.

2.. In Access, open any Module in design view. Then select Tools \
References
and make sure that you have a reference to the appropriate Word library.
Look for "Microsoft Word xx.x Object Library, where xx.x is the version
number. For this example, you will also need a reference to DAO.

3.. Behind a command button on a form, insert the following code.

Dim objWord As Object
' Open Microsoft Word using automation
Set objWord = New Word.Application
objWord.Documents.Add "c:\FormLetter.dot"
objWord.Visible = True

If objWord.ActiveDocument.Bookmarks.Exists("FirstName") = True Then
objWord.ActiveDocument.Bookmarks("FirstName").Range.Text = me!FirstName
End If

If objWord.ActiveDocument.Bookmarks.Exists("LastName") = True Then
objWord.ActiveDocument.Bookmarks("LastName").Range.Text = me!LastName
End If

' ... continue reading data from form and inserting into bookmark


Note: In addition, you can also create multiple documents in Word while
looping through a recordset in Access.
 
PC Datasheet said:
First, go to Word Help file and look up how to create and use templates.
Then see below my signature line.


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

If you don't get the help you need in the newsgroup, I can help you for a
very reasonable fee.
Over 1000 Access users have come to me for help.

These 1000 (if at all a real figure..) is only the result of
-- 4 years abusing the newsgroups.
-- 4 years blatantly advertising and job hunting.

You only care about making money, and you act as if the groups are your private hunting ground.
So why would ANYBODY ever trust a person like you and hire you?
********************************************************

Explanation and more on this answer to Steve:
http://home.tiscali.nl/arracom/stopsteve.html

Arno R
 
PC said:
First, go to Word Help file and look up how to create and use templates.
...

More helpful than "templates", if I understand the question correctly,
would be "Mail Merge". You link that to your database of names, and
plug the names (and other desired fields) into your form letter.

You might choose to save it as a template, for future use, or you might
just save it as a document and modify it as needed in the future.
 
Back
Top