Word Mail Merge Automation

J

jas

sPath = App.Path & "\Test.dot"

Set objWordApp = CreateObject("word.application")

objWordApp.Visible = True

Set objWordDoc = objWordApp.Documents.Add(sPath)

objWordDoc.MailMerge.MainDocumentType = wdFormLetters
objWordDoc.MailMerge.Destination = wdSendToNewDocument

objWordDoc.MailMerge.OpenDataSource name:=App.Path & "\Test.mdb",
PasswordDocument:="test", connection:="QUERY TestRptQry"

objWordDoc.MailMerge.Execute

objWordDoc.Close False
 
H

Hugh Janus

I take it you've read all the relevant documentation on MSDN?

What about using:

With ActiveDocument.MailMerge
.MainDocumentType = wdFormLetters
strConnection = "DSN=MS Access Databases;" _
& "DBQ=C:\Northwind.mdb;" _
& "FIL=RedISAM;"
.OpenDataSource Name:="C:\NorthWind.mdb", _
Connection:=strConnection, _
SQLStatement:="SELECT * FROM Customers"
End With


Tried this?


Hugh
Bobtech Industries


----stupid is as stupid does----
 
H

Hugh Janus

Jas,

If you're really struggling on something as simple as this, perhaps you
should consider contracting out the task? Like they say, you need a license
to drive, but they will let any monkey loose with VBA!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top