Word Mail Merge Run time 5852 Error

C

Craig Lindstrom

Our application is getting the 5852 error caused by Word Mail Merge trying to
run SQL. It's fixable by a registry edit, but we'll have new machines, AND,
frankly, I don't like that the registry edit opens up ALL SQL commands (is
that right?).

Yes, we're running Word XP, 2003 and 2007 - MS even shows registry edits for
2002, 2003, and 2007.

Can't I sign the macro (with a security certificate)? Isn't that a better
way? Shouldn't that be recomended in the knowledge base? Are the better
options to NOT doing a SQLSecurityCheck in Word?

Ok, here are the details:

The error is:

Run-time error '5852':
Requested object is not available.

as described at the bottom of
http://support.microsoft.com/kb/829121/en-us

"This error occurs because Word 2003 or Word 2007 displays a message box
when you try to open a Word 2003 mail merge document that is linked to a data
source. The default value is No, and Word 2003 or Word 2007 will not run the
SQL command.

However, if you open the mail merge document in code by using automation,
you have no opportunity to select Yes. The default value No is used.
Therefore, the SQL command does not run and you cannot gain access to the
data. To make the previous code sample run correctly, you must create the
following registry key for Word 2003:" ...

The workaround is described at:

http://support.microsoft.com/kb/825765/

Thanks!

Craig
 
C

Cindy M.

Hi Diane,

In Word 2003 (and I thought 2007) opening a Word document using automation
unlinked the data source, so no message would appear. I understand that, in a
recent update, this behavior was changed to display the message as soon as a
document is detected as a mail merge document. A bit ridiculous, really.

Unfortunately, this isn't covered by any kind of certificate - but that is
definitely a good idea.

All you can do, really, is to set the document back to a "Normal Word document"
after setting up the mail merge, then have your code open the document, set the
mail merge type, and attach the data source. Depending on what that is, that
line of code could be fairly straight-forward or a pain to figure out.

The best place to get assistance is the Mail Merge newsgroup, where you'll find
people who specialize in this kind of thing.
Our application is getting the 5852 error caused by Word Mail Merge trying to
run SQL. It's fixable by a registry edit, but we'll have new machines, AND,
frankly, I don't like that the registry edit opens up ALL SQL commands (is
that right?).

Yes, we're running Word XP, 2003 and 2007 - MS even shows registry edits for
2002, 2003, and 2007.

Can't I sign the macro (with a security certificate)? Isn't that a better
way? Shouldn't that be recomended in the knowledge base? Are the better
options to NOT doing a SQLSecurityCheck in Word?

Ok, here are the details:

The error is:

Run-time error '5852':
Requested object is not available.

as described at the bottom of
http://support.microsoft.com/kb/829121/en-us

"This error occurs because Word 2003 or Word 2007 displays a message box
when you try to open a Word 2003 mail merge document that is linked to a data
source. The default value is No, and Word 2003 or Word 2007 will not run the
SQL command.

However, if you open the mail merge document in code by using automation,
you have no opportunity to select Yes. The default value No is used.
Therefore, the SQL command does not run and you cannot gain access to the
data. To make the previous code sample run correctly, you must create the
following registry key for Word 2003:" ...

The workaround is described at:

http://support.microsoft.com/kb/825765/

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
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

Curt

Running 2000 got 5852 for first time use same .Destination = wd
SendToNewDocument lime in other macros with no problem now it says object not
available. Any Ideas
Thanks
 

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