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
Hugh Janus - 27 Oct 2004 11:25 GMT
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----
> sPath = App.Path & "\Test.dot"
>
[quoted text clipped - 13 lines]
>
> objWordDoc.Close False
Hugh Janus - 27 Oct 2004 11:34 GMT
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!
> sPath = App.Path & "\Test.dot"
>
[quoted text clipped - 13 lines]
>
> objWordDoc.Close False