Help with creating data source for mail merge via VBA

J

John Head

I am looking for some suggestions. I have an application
that does automated mail merge between lotus notes and
word. it works with both word 2000 and xp. today, i hit
the 63 column limit in a word table. that means i can not
longer use the word document with a table as the data
source.

so i am trying to figure out the best way to create the
data source programmaticly. I can easily create a csv
file and i can create an excel file fairly easily. i went
looking thru the help to see if i could automate teh
create data source process that mail merge has in it, but
no luck.

I would greatly appreciate any suggestions, help, or even
sample code if anyone has good ideas to share! I am
looking for a solution for both word 2000 and xp, but can
deal with something that is just word xp if I have too.

Thanks - John
 
P

Peter Jamieson

Basically, you need to look at Word VBA's OpenDataSource method. You may
find it useful to macro record a few of them as you link to different types
of data source manually. Typically, the only parameters you need are Name,
COnnection, SQLStatement, perhaps SQLStatement1, and in the case of Word
2002, Subtype.

However, because Word 2000 and Word 2002 use different default mechanisms to
connect to certain types of data source,
a. you may find it is dificult to achieve consistent behaviour between the
two versions
b. you may need to use Subtype in Word 2002 -
Subtype:=wdMergeSubtypeWord2000 sets up the Word 2002 connection mechanism
to be the same as Word 2000's. But the parameter does not exist in Word
2000, so either you need to work around that or avoid using the Subtype
parameter.

For those reasons I would consider using a Word .doc with tab-delimited
data. You shouldn't encounter the 64 column limitation in that case
(although I may have misremembered), and you should not have to use the
subtype. The main drawback is that Word 2002's performance when using .doc
data sources can be pitiful.
 

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