CSV question

S

Steve Grosz

I have a CSV file I'm generating from database info, and then using in a
mailmerge for printing envelopes.

I'm trying to find out if there is a way to 'examine' the CSV data and find
out if a 2nd field is there or not, before the merge occurs.

For example, if I have address1, and address2, address2 isnt always going to
be there (apt #, suite, etc). But if it is, I'd like to have it formatted
differently than if its just address1.

Is there a way to examine the CSV file within Word?
 
M

macropod

Hi Steve,

You can format mergefield results independently of the rest of the document's formatting via Charformat switches (see Word's help
file on how to use these). This would be enough if its only the 'address2' that you want to apply the different formatting to. If
you're wanting to modify bith the address1 & address2 fields if address2 isn't blank, you could use a simple IF test in conjection
with the mergefield and Charformat switches. For example:
{IF{MERGEFIELD address2}= "" "{MERGEFIELD address1 \* Charformat}" "{MERGEFIELD address1\* Charformat}{MERGEFIELD address2\*
Charformat}"}
paying careful attention to the spacing and quote characters.

Note: the field braces (ie '{ }') must be created in pairs via Ctrl-F9 or Insert|Field - you can't simply type them from the
keyboard.

Cheers
 

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