Connecting Tech Pros Worldwide Forums | Help | Site Map

Automate Word Mail Merge - Conversion Issue

johnvon
Guest
 
Posts: n/a
#1: May 15 '06
I have a mail merge that runs flawlessly in Access 2000. In 2003 I keep
getting dialog boxes that I can't figure out how to supress. Several of them
are telling me that Admin (me!) has the database opened (duh!). I then get a
logon dialog box, which I cancel. The merge then runs perfectly! How do I
supress all of these dialog boxes.

Thanks!

John



jahoobob via AccessMonster.com
Guest
 
Posts: n/a
#2: May 15 '06

re: Automate Word Mail Merge - Conversion Issue


Are you running the mail merge from within Access or within Word. In looking
at Access Help I see that you can export a table or query to a mail merge
source file or you can actually do a mail merge but it has to be within Word.
If the latter is you case, close Access.

johnvon wrote:[color=blue]
>I have a mail merge that runs flawlessly in Access 2000. In 2003 I keep
>getting dialog boxes that I can't figure out how to supress. Several of them
>are telling me that Admin (me!) has the database opened (duh!). I then get a
>logon dialog box, which I cancel. The merge then runs perfectly! How do I
>supress all of these dialog boxes.
>
>Thanks!
>
>John[/color]

--
Message posted via http://www.accessmonster.com
Arno R
Guest
 
Posts: n/a
#3: May 15 '06

re: Automate Word Mail Merge - Conversion Issue


I guess the new security-'features' that are 'nagging' you.
I suggest you post the code you are using now.

Arno R

"johnvon" <johnvonc@earthlink.net> schreef in bericht news:C0Q9g.2520$y4.124@newsread2.news.pas.earthlin k.net...[color=blue]
>I have a mail merge that runs flawlessly in Access 2000. In 2003 I keep
> getting dialog boxes that I can't figure out how to supress. Several of them
> are telling me that Admin (me!) has the database opened (duh!). I then get a
> logon dialog box, which I cancel. The merge then runs perfectly! How do I
> supress all of these dialog boxes.
>
> Thanks!
>
> John
>
>[/color]
johnvon
Guest
 
Posts: n/a
#4: May 16 '06

re: Automate Word Mail Merge - Conversion Issue


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

"Arno R" <arraNOcomSPAM@tiscali.nl> wrote in message
news:4468b0a1$0$2016$ba620dc5@text.nova.planet.nl. ..
I guess the new security-'features' that are 'nagging' you.
I suggest you post the code you are using now.

Arno R

"johnvon" <johnvonc@earthlink.net> schreef in bericht
news:C0Q9g.2520$y4.124@newsread2.news.pas.earthlin k.net...[color=blue]
>I have a mail merge that runs flawlessly in Access 2000. In 2003 I keep
> getting dialog boxes that I can't figure out how to supress. Several of[/color]
them[color=blue]
> are telling me that Admin (me!) has the database opened (duh!). I then get[/color]
a[color=blue]
> logon dialog box, which I cancel. The merge then runs perfectly! How do I
> supress all of these dialog boxes.
>
> Thanks!
>
> John
>
>[/color]


Arno R
Guest
 
Posts: n/a
#5: May 16 '06

re: Automate Word Mail Merge - Conversion Issue



"johnvon" <johnvonc@earthlink.net> schreef in bericht news:wR8ag.2867$y4.2608@newsread2.news.pas.earthli nk.net...[color=blue]
> 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[/color]


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
johnvon
Guest
 
Posts: n/a
#6: May 17 '06

re: Automate Word Mail Merge - Conversion Issue


Arno,

Thanks! I'm glad to see someone has a work around!

John

"Arno R" <arraNOcomSPAM@tiscali.nl> wrote in message
news:44699760$0$2019$ba620dc5@text.nova.planet.nl. ..

"johnvon" <johnvonc@earthlink.net> schreef in bericht
news:wR8ag.2867$y4.2608@newsread2.news.pas.earthli nk.net...[color=blue]
> 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[/color]


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


Closed Thread


Similar Microsoft Access / VBA bytes