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