Mail Merge w/Docvariables

D

Diane

Group,
I have a vb program that creates MS WORD 2003 documents, in the processing,
some data is determined by docvariable fields - all works. The process is
now in a testing stage that is changing to a "mail merge process". Can a
mail merge document contain a "docvariable field". OR does one choose,
either use a mail merge process OR docvariables - not combining the both?
 
J

Jean-Guy Marcil

Diane was telling us:
Diane nous racontait que :
Group,
I have a vb program that creates MS WORD 2003 documents, in the
processing, some data is determined by docvariable fields - all
works. The process is now in a testing stage that is changing to a
"mail merge process". Can a mail merge document contain a
"docvariable field". OR does one choose, either use a mail merge
process OR docvariables - not combining the both?

You will need to ne more explicit, especially regarding how you use the
DOCVARIABLE and to what end.
 
P

Peter Jamieson

Can a mail merge document contain a
"docvariable field"

Yes. However, if what your vb program is doing is setting the values of
Word variables, then updating all the (DOCVARIABLE) fields in the
document, then outputting that document for each record in a data
source, your new process would need to reflect that fact. Typically,
once you have initiated a mailmerge, Word does everything else and
processes all the selected records in the data source - i.e. none of the
Variables would change, so the DOCVARIABLE fields would always have the
same results.

If the Variables have to change for each record in the data source, you
would need either
a. to construct a mailmerge process that performed a separate
mailmerge for each record in the data source (this is only really simple
in the case where the merge does not consume multiple records e.g. using
{ NEXT fields etc.) or
b. to use Word's Mailmerge Events to modify the Variables for each
record in the data source, as the merge progresses.

However, in the event that you need different data for different
records, it's preferable to construct the merge data source that you
need, in which case it would probably be a simplification to ditch those
Variables and use MERGEFIELD fields instead.

Peter Jamieson

http://tips.pjmsn.me.uk
 
D

Diane

Peter,
Thank you for the information you provided. The mail merge document is now
working with the DOCVARIABLE field. Initially, the testing was not working
as expected, I wasn't sure if there was a rule that states not to mix
DOCVARIABLEs w/MERGEFIELDS - but now I realize it can be done.

Again, thanks for the detailed information.
 

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