Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / October 2004

Tip: Looking for answers? Try searching our database.

Word Mail Merge Automation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jas - 27 Oct 2004 11:12 GMT
   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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.