Q. To mail merge to many different documents from within Access 2k to Word
2k I?ve used code, which part is show below. I?ve removed the none
essentials. It works well and consistantly, if a little slowly. The core
activity is the GetObject function. The question is this the most
efficient approach? Comments welcome.
Thanks johnb
On Error Resume Next
Dim oWord As Word.Document
Dim DocOut As Word.Document
Dim db As Database
Dim rec As Recordset
Dim iCount As Integer
Set db = CurrentDb()
Set rec = db.OpenRecordset("qryNoneRTGMerge")
rec.MoveLast
If rec.RecordCount <= 0 Then
GoTo NoRecords
End If
Set oWord = GetObject("T:\letters\MainDocV1.doc", "Word.Document")
oWord.Application.Visible = True
oWord.MailMerge.OpenDataSource Name:="T:\database" & _
"LetterProduction v9.mdb", Connection:="query qryNoneRTGMerge"
'
With oWord
.MailMerge.Destination = wdSendToNewDocument
.MailMerge.Execute
End With
more code
end sub
MainDocV1.doc acts as a dealer document to 100 or so other different
letters.