Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / 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 - 26 Oct 2004 16:42 GMT
anyone know how to automate WORD mail merge with VB6, without Access
prompting me for a password?

i have a secure access 97 database (i.e. it has a password)
i have created a Word template that i intend to mail merge with the above
database

i have the following code

   sPath = App.Path & "\TestTemplate.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 & "\myDatabase.mdb",
PasswordDocument:="myPassword", connection:="QUERY myReportQuery"

   objWordDoc.MailMerge.Execute

   objWordDoc.Close False
Ken Halter - 26 Oct 2004 16:45 GMT
> PasswordDocument:="myPassword", connection:="QUERY myReportQuery"

If the DB is password protected, you'll have to supply a valid password.
If that wasn't the case, the password protection would be worthless.

Signature

Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..

 
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



©2009 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.