G
Guest
Hi all,
Using the code from article ID 209976 I am getting a complie error: sub or
function not defined when I test the code in the immediate window. Below is
the code which I have revised slightly. Can anyone tell me why I am getting
this error and what I need to do to fix it?
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\Contracts_Database.mdb", _
LinkToSource:=True, Connection:="QUERY Qry_Letters_BPV_ComplExpired", _
SQLStatement:="SELECT * from Qry_Letters_BPV_ComplExpired"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Thank you
Using the code from article ID 209976 I am getting a complie error: sub or
function not defined when I test the code in the immediate window. Below is
the code which I have revised slightly. Can anyone tell me why I am getting
this error and what I need to do to fix it?
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\Contracts_Database.mdb", _
LinkToSource:=True, Connection:="QUERY Qry_Letters_BPV_ComplExpired", _
SQLStatement:="SELECT * from Qry_Letters_BPV_ComplExpired"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
Thank you