Automation of Mail Merge Excel and Word

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

Automation of Mail Merge Excel and Word

Post by giovanniroi » Fri Jun 29, 2012 4:49 pm

Dear Support,
I need to automatize a Mail Merge from a Excel file and Word document. I Find this code on web, can You help me to convert this in macro scheduler code:

=====================
Function MailMergeStart()
Dim objWord As Word.Document
Set objWord = GetObject("c:\Temp\file.doc", "Word.Document")
' Make Word visible.
objWord.Application.Visible = True
' Set the mail merge data source as Excel File.
objWord.MailMerge.OpenDataSource _
Name:="c:\temp\TLS54C_name_CLIENT", _
LinkToSource:=True, _
Connection:=" query nomequerycollegata", _
SQLStatement:="SELECT * FROM TLS54C_name_CLIENT"
' Execute the mail merge.
objWord.MailMerge.Execute
End Function
=================

Thank's for the support

Giovanni Roi

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts