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
Cindy M -WordMVP- - 19 Aug 2005 10:31 GMT
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 :-)
Neil - 19 Aug 2005 10:52 GMT
Thanks, Cindy. That addresses the issue.
Neil
> Hi Neil,
>
[quoted text clipped - 25 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 19 Aug 2005 10:31 GMT
Replied to this duplicate question in one of the
office.devloper newsgroups.
Cindy Meister