stnkyminky
Programmer
I am trying to execute the following code in an Access application. The code will open Word but hangs on the open datasource window. I assume that window shouldn't appear since I am providing the source thru code.
BTW The client machine is using MS Access runtime.
Thanks
Dim objWord As Word.Application
Dim objDoc As Word.Document
On Error GoTo errorhandler
Set objWord = CreateObject("Word.Application"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Set objDoc = objWord.Documents.Open("m:\scott\ship_1.doc"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
' Make Word visible.
objWord.Application.Visible = True
objDoc.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE tbl_sw_ron's_shipments", _
SQLStatement:="Select * from tbl_sw_ron's_shipments"
' Execute the mail merge.
objDoc.MailMerge.Execute
Set objDoc = Nothing
Set objWord = Nothing
Exit Function
errorhandler:
MsgBox Err.Description & " " & Err.Number
Set objDoc = Nothing
Set objWord = Nothing Scott
Programmer Analyst
BTW The client machine is using MS Access runtime.
Thanks
Dim objWord As Word.Application
Dim objDoc As Word.Document
On Error GoTo errorhandler
Set objWord = CreateObject("Word.Application"
Set objDoc = objWord.Documents.Open("m:\scott\ship_1.doc"
' Make Word visible.
objWord.Application.Visible = True
objDoc.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE tbl_sw_ron's_shipments", _
SQLStatement:="Select * from tbl_sw_ron's_shipments"
' Execute the mail merge.
objDoc.MailMerge.Execute
Set objDoc = Nothing
Set objWord = Nothing
Exit Function
errorhandler:
MsgBox Err.Description & " " & Err.Number
Set objDoc = Nothing
Set objWord = Nothing Scott
Programmer Analyst