Doing a MailMerge to Word 2007

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top