Problem with Word Code in 2003

N

Neil

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
 
C

Cindy M -WordMVP-

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 :)
 
C

Cindy M -WordMVP-

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

Cindy Meister
 
N

Neil

Thanks, Cindy. That addresses the issue.

Neil

Cindy M -WordMVP- said:
Hi Neil,

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)


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top