I am performing a mail merge in Word through an Access database. As part of
the process, I check to see if a Word document is already a mail merge
document, and then, if it is, if it has the correct data source. Thus, from
within Access, I use:

If objWord.ActiveDocument.MailMerge.State=wdMainAndDataSource Then
...

This has worked fine with Access/Word 2000, or if the program is used with
Access/Word 2002. However, with Access/Word 2003, the MailMerge.State value
returns wdNormalDocument (0) instead of wdMainAndDataSource (2). I
double-checked the document, and it clearly is a mail merge main document
with a data source. When when read through Access, I get the return value of
a normal document.

Any ideas as to what's going on?

Thanks,

Neil

Re: Problem with Word Code in 2003 by Cindy

Cindy
Fri Aug 19 04:31:36 CDT 2005

Hi Neil,

> This has worked fine with Access/Word 2000, or if the program is used with
> Access/Word 2002. However, with Access/Word 2003, the MailMerge.State value
> returns wdNormalDocument (0) instead of wdMainAndDataSource (2).
>
See this article

"Opening This Will Run the Following SQL Command" Message When You Open a Word
Document - 825765
http://support.microsoft.com?kbid=825765

When you automate opening a Word main merge document, the link to the data
source is cut off without warning you. You either have to use .OpenDataSource
after opening the document, or make sure the Registry key is set to disable
the security question.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)


Re: Problem with Word Code in 2003 by Cindy

Cindy
Fri Aug 19 04:31:49 CDT 2005

Replied to this duplicate question in one of the
office.devloper newsgroups.

Cindy Meister


Re: Problem with Word Code in 2003 by Neil

Neil
Fri Aug 19 04:52:19 CDT 2005

Thanks, Cindy. That addresses the issue.

Neil

"Cindy M -WordMVP-" <C.Meister-C@hispeed.ch> wrote in message
news:VA.0000b28a.006cfba8@speedy...
> Hi Neil,
>
>> This has worked fine with Access/Word 2000, or if the program is used
>> with
>> Access/Word 2002. However, with Access/Word 2003, the MailMerge.State
>> value
>> returns wdNormalDocument (0) instead of wdMainAndDataSource (2).
>>
> See this article
>
> "Opening This Will Run the Following SQL Command" Message When You Open a
> Word
> Document - 825765
> http://support.microsoft.com?kbid=825765
>
> When you automate opening a Word main merge document, the link to the data
> source is cut off without warning you. You either have to use
> .OpenDataSource
> after opening the document, or make sure the Registry key is set to
> disable
> the security question.
>
> Cindy Meister
> INTER-Solutions, Switzerland
> http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
> http://www.word.mvps.org
>
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
>