G
Guest
Hi all,
Here I am again, still working on getting the automation to work with Access
and Word mail merge. I am no longer getting the Word cannot open the data
source error but now I am getting the above referenced "Run-time error '287':
Application-defined or object-defined error" which really stumps me because
I got the code from article #209976. See below:
Function MergeItExp()
Dim ObjWord As Word.Document
Set ObjWord =
GetObject("G:\User\Contracts\Data_Files\Access_Security\Expire_Letters.doc",
"Word.Document")
' Make Word Visible
ObjWord.Application.Visible = True
' Set the mail merge data source as the Contracts_Database.mdb
ObjWord.MailMerge.OpenDataSource
Name:="G:\User\Contracts\Data_Files\Access_Security\copy (3) of
contracts_database.mdb", _
LinkToSource:=True, _
PasswordDocument:="", _
Connection:="QUERY Qry_Letters_BPV_CmplExpired", _
SQLStatement:="SELECT * FROM Qry_Letters_BPV_CmplExpired"
' Execute the mailmerge
ObjWord.MailMerge.Execute
End Function
I think it might have to do with my references but I can't seem to put my
finger on it. I researched and worked on this all day. Can someone please
help me?
Thank you,
Here I am again, still working on getting the automation to work with Access
and Word mail merge. I am no longer getting the Word cannot open the data
source error but now I am getting the above referenced "Run-time error '287':
Application-defined or object-defined error" which really stumps me because
I got the code from article #209976. See below:
Function MergeItExp()
Dim ObjWord As Word.Document
Set ObjWord =
GetObject("G:\User\Contracts\Data_Files\Access_Security\Expire_Letters.doc",
"Word.Document")
' Make Word Visible
ObjWord.Application.Visible = True
' Set the mail merge data source as the Contracts_Database.mdb
ObjWord.MailMerge.OpenDataSource
Name:="G:\User\Contracts\Data_Files\Access_Security\copy (3) of
contracts_database.mdb", _
LinkToSource:=True, _
PasswordDocument:="", _
Connection:="QUERY Qry_Letters_BPV_CmplExpired", _
SQLStatement:="SELECT * FROM Qry_Letters_BPV_CmplExpired"
' Execute the mailmerge
ObjWord.MailMerge.Execute
End Function
I think it might have to do with my references but I can't seem to put my
finger on it. I researched and worked on this all day. Can someone please
help me?
Thank you,