Arno,
Thanks! I'm glad to see someone has a work around!
John
"Arno R" <ar***********@tiscali.nl> wrote in message
news:44**********************@text.nova.planet.nl. ..
"johnvon" <jo******@earthlink.net> schreef in bericht
news:wR****************@newsread2.news.pas.earthli nk.net...
Here is the code I am using. I pass a data source (pstrDataSource) to the
function in case the data source is missing:
Set objWord = New Word.Application
With objWord
Set docWord = objWord.Documents.Open(pstrDocName)
DoEvents
.Application.Visible = True
strC = "QUERY " + pstrDataSource
DoEvents
If Len(Trim(pstrDataSource)) > 0 Then
If Len(Trim(docWord.MailMerge.DataSource.Name)) = 0 And _
docWord.MailMerge.DataSource.ConnectString <> "QUERY " +
pstrDataSource Then
strPath = CurrentDb.Name
'here is the line where I start getting the dialogs...
docWord.MailMerge.OpenDataSource Name:=strPath, _
LinkToSource:=True, _
Connection:=strC, _
ReadOnly:=True
docWord.Save
End If
End If
Sorry, I see now that I misread your initial question.
I thought you had difficulty with Word2003 compared with Word2000.
I also had the same issues with that.
But you said that Access2003 was the culprit here.
I see you are connection to the same database that you are working with.
When you secure the db you will get even more login issues.
I would use an 'outside' connection. Export the records and fields you need
to a csv-file.
I create (and test) a csv-file prior to the merge-code.
Don't know if this helps you since it is not exactly what you asked, but the
following code works for me (late binding).
Sub MergeWord(strDatacsv, strWordDoc)
Dim objWord As Object
Dim docWord As Object
Dim strActiveDoc As String
Set objWord = CreateObject("Word.Application")
Set docWord = objWord.Documents.Open(strWordDoc)
With docWord.MailMerge
.OpenDataSource Name:=strDatacsv, LinkToSource:=True
.Destination = 0 ' 0 = new document
.SuppressBlankLines = True
.Execute Pause:=True
End With
docWord.Close (False)
objWord.Visible = True
objWord.Windows(objWord.Windows.Count).Activate
strActiveDoc = objWord.ActiveDocument.Name
DoCmd.Hourglass False
Set objWord = Nothing
Set docWord = Nothing
AppActivate strActiveDoc
Exit Sub
Arno R