Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation error in mail merge

Status
Not open for further replies.

topdesk123

Programmer
Sep 27, 2001
76
US
I use the following code to open and merge customer letters.

Dim objWord As Word.Document
Set objWord = GetObject("C:\client\customer bid letter.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source
objWord.MailMerge.OpenDataSource _
Name:="C:\client\templettertable.xls", _
LinkToSource:=True, _
Connection:="TABLE templettertable", _
SQLStatement:="SELECT * FROM [templettertable.xls]"
' Execute the mail merge.
objWord.MailMerge.Execute

For references I have Microsoft Word 10.0 Object Library and Microsoft Office 11.0 Object Library. I am using Word 2002 SP3 - my client is using Word 2003 SP1 - the only difference in their references is Word 2003 Object Library. When they try and print letters they get an automation error. Is there something I can modify in my code to avoid this problem? I'm assuming each machine could potentially have different versions installed.

Thank you so much!
topdesk123
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top