Click to See Complete Forum and Search --> : Mail Merge Data Source


Unload Me
September 28th, 2001, 05:39 AM
Does anyone have some code for setting the OpenDataSource on a Word Automation Mail Merge to use SQL Server via OLE DB, looked everywhere but no joy...
Thanks
Only found Access see below:


ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Automation\Northwind.MDB", ConfirmConversions:=False, _
ReadOnly:=False, LinkToSource:=True, AddToRecentFiles:=False, _
PasswordDocument:="", PasswordTemplate:="", WritePasswordDocument:="", _
WritePasswordTemplate:="", Revert:=False, Format:=wdOpenFormatAuto, _
Connection:="QUERY qryEmployeeLetters", SQLStatement:= _
"SELECT * FROM [qryEmployeeLetters]", SQLStatement1:=""

With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.Execute
End With