Doing a MailMerge to Word 2007

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

Guest

The code below has worked for years until my client updated their software to
2007. Now the mail merge part is broken. Any ideas?

Set myWord = New Word.Application

myWord.Visible = True

'Start a new main document for the mail merge.
Set myDoc = myWord.Documents.Open(sFileName)

With myDoc.MailMerge

.MainDocumentType = wdFormLetters

'Set up the mail merge data source.
sDBPath = CurrentProject.FullName
.OpenDataSource Name:=sDBPath, SQLStatement:="SELECT * FROM
[qryThankYou]"
.Destination = wdSendToNewDocument
.Execute Pause:=False
End With

myDoc.Close
 
Back
Top