enter an excel module global variable value in a mailmerge letter

W

windowed

I'm working on a Word 2002 mail merge that's based on an Excel 2002
spreadsheet that's based on an underlying Acess97 DB. This is for a
quarterly billing letter to donors.

When the spreadsheet opens, a dialog box opens requesting information,
including numbers of houses billed this quarter and YTD. These are stored
in global variables in an excell VBA module (e.g., intNumHsBilldYTD).

In the letter, which has a complex if...then...else, I need to insert the
numbers in some but not all of the merged letters, depending on which
"if" condition is met. My question is, how do I reference it in the
mailmerge form to print the values in the letters?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?d2luZG93ZWQ=?=,

Mail merge can only pick up information in the data table, so the easiest
way would be to insert an additional column for each variable and enter the
value. Yes, I know, it would be the same entry for every record... but
perhaps you could pre-process the condition using VBA or a formula in that
Excel column. Then mail merge would be able to pick up the result, which
would be a lot faster, as far as mail merge is concerned.

Your only other possibility would involve automating Word to put this data
into the Word document. Probably as a document Variable (that's an object in
Word's OM), then use a DocVariable field in the If.
I'm working on a Word 2002 mail merge that's based on an Excel 2002
spreadsheet that's based on an underlying Acess97 DB. This is for a
quarterly billing letter to donors.

When the spreadsheet opens, a dialog box opens requesting information,
including numbers of houses billed this quarter and YTD. These are stored
in global variables in an excell VBA module (e.g., intNumHsBilldYTD).

In the letter, which has a complex if...then...else, I need to insert the
numbers in some but not all of the merged letters, depending on which
"if" condition is met. My question is, how do I reference it in the
mailmerge form to print the values in the letters?

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

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