Automating MailMerge from Access - Word unable to open datasource

E

Emma Aumack

Hi all,

Using A2K Office 2K, I am trying to automate a mailmerge from my access
database. Using the code from Article 209976 as revised below, I am getting
the error "Word unable to open datasource" can anyone tell me why?

Function MergeItExp()

Dim objWord As Word.Document

Set objWord =
GetObject("G:\USER\Contracts\Data_Files\Access_Security\Expire_letter.doc",
"Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as the Northwind database.
objWord.MailMerge.OpenDataSource _
Name:="G:\USER\Contracts\Data_Files\Access_Security\Copy (2) of
Contracts_Database.mdb", _
LinkToSource:=True, Connection:="TABLE 1_Expired_Letters", _
SQLStatement:="SELECT * from 1_Expired_Letters"
' Execute the mail merge.
objWord.MailMerge.Execute

End Function

Thank you,
 

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