"Larry Linson" <bo*****@localh ost.not> wrote:
Yes, but it is a Word VBA/VB.NET question... you'd use VBA (or,
alternativel y, VB.NET or C#, with Word 2003) to manipulate the Word object
model.
I disagree. I think the better approach would be to create each recipients Word .doc
as a seperate file and email it. All inside a recordset loop within Access.
Here's some sample code emailed to me by Arvin Meyer a while back which shows the
details of doing a "merge" with word. Clearly you'd have to make some changes at the
bottom to save the file with a unique name, etc, etc.
Tony
Private Sub cmdMergeLetter_ Click()
On Error GoTo Err_cmdMergeLet ter_Click
Dim WordTemplate As String
Dim strFullName As String
Dim objWord As Word.Applicatio n
Set objWord = CreateObject("W ord.Application ")
WordTemplate = Application.Cur rentProject.Pat h & "\Letter.do t"
strFullName = Me.txtPersonFir stName & " " & Me.txtPersonLas tName
With objWord
.Visible = True
.Documents.Add (WordTemplate)
.Caption = "Letter to " & strFullName & "
' If document is protected, Unprotect it.
If .ActiveDocument .ProtectionType <> wdNoProtection Then
.ActiveDocument .Unprotect Password:=""
End If
.ActiveDocument .Bookmarks("Com panyName").Sele ct
.Selection.Text = (CStr(Me.txtCom panyName))
.ActiveDocument .Bookmarks("Fir stName").Select
.Selection.Text = (CStr(Me.txtPer sonFirstName))
.ActiveDocument .Bookmarks("Las tName").Select
.Selection.Text = (CStr(Me.txtPer sonLastName))
.ActiveDocument .Bookmarks("Add ress").Select
.Selection.Text = (CStr(Me.txtPer sonAddress))
.ActiveDocument .Bookmarks("Cit y").Select
.Selection.Text = (CStr(Me.txtPer sonCity))
.ActiveDocument .Bookmarks("Sta te").Select
.Selection.Text = (CStr(Me.txtPer sonState))
.ActiveDocument .Bookmarks("Zip Code").Select
.Selection.Text = (CStr(Me.txtZip ))
.ActiveDocument .Bookmarks("Nam e").Select
.Selection.Text = (CStr(Me.Parent .txtPersonFirst Name))
.Activate
' ReProtect the document.
If .ActiveDocument .ProtectionType = wdNoProtection Then
.ActiveDocument .Protect Type:=wdAllowOn lyFormFields,
NoReset:=True
End If
.ActiveDocument .PrintOut
.ActiveDocument .Close (wdDoNotSaveCha nges)
End With
Exit_cmdMergeLe tter_Click:
objWord.Quit
Set objWord = Nothing
Exit Sub
Err_cmdMergeLet ter_Click:
MsgBox Err.Number & ": " & Err.Description , vbInformation, "Error"
Resume Exit_cmdMergeLe tter_Click
End Sub
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm