Create letter from information in database

  • Thread starter Thread starter Russ via AccessMonster.com
  • Start date Start date
R

Russ via AccessMonster.com

Can someone help, need to create a letter from information in my contacts
table.
Letter needs to start like;
To [companyname]
Attn:[Contactname]
Anyone have suggestions on how to do this?
 
Sorry, forgot to mention the letter needs to be a Microsoft Word document...
 
I did a Word mail merge nearly eight years ago and haven't touched it
since then, although that's coming up soon. MS Word does have a Wizard
to walk you through everything that you need. For additional help, try
the microsoft.public.word.vba.general newsgroup. Once you've got the
mail merge working, post back if you need help opening Word from Access
and running it.
 
Sorry, forgot to mention the letter needs to be a Microsoft Word
document...

Maybe you can use something like this.
You need a Word template with two bookmarks "companyname" and "contactname".


'Dim oDoc As Word.Document 'early binding
'Dim oWord As Word.Application 'early binding
Dim oDoc As Object 'late binding
Dim oWord As Object 'late binding
Set oWord = CreateObject("word.application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add("full path to your template")

If oWord.ActiveDocument.Bookmarks.Exists("companyname") = True Then
oWord.ActiveDocument.Bookmarks("companyname").range.Text = "the text
that goes in companyname"
End If
If oWord.ActiveDocument.Bookmarks.Exists("contactname") = True Then
oWord.ActiveDocument.Bookmarks("contactname").range.Text = "the text
that goes in contactname"
End If

Set oWord = Nothing
Set oDoc = Nothing



Jesper F, Denmark
 
Back
Top