Word Merge throws exception

D

David Carey

Hi

I'm running a C++ app that uses Word automation to merge
data into a Word template. In the past this app has always
worked OK, but now calling the MailMerge::Execute method
results in a COleDispatchException being thrown and the
following message is popped up: "Word could not finish
merging these documents or inserting this database".

I believe this is the first time I've tried to run this
app with Word 2002 as opposed to Word 2000.

Any assistance would be much appreciated.

Dave Carey
 
P

Peter Jamieson

The problem is probably as follows.

If you are also establishing the connection to the data source in your C++
code (and possibly even if you are not) and you were using ODBC to connect,
you will need an extra parameter in the OpenDataSource call - in VBA it
would be

Subtype=wdMergeSubtypeWord2000

The Subtype parameter does not exist in Word 2000 or earlier. The
wdMergeSubtypeWord2000 value makes Word use (roughly) the same approach to
opening data sources as it did in Word 2000.
 

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