Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2007

Tip: Looking for answers? Try searching our database.

CSV question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Grosz - 26 Dec 2007 19:27 GMT
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?
macropod - 27 Dec 2007 04:28 GMT
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
Signature

macropod
[MVP - Microsoft Word]
-------------------------

>I have a CSV file I'm generating from database info, and then using in a mailmerge for printing envelopes.
>
[quoted text clipped - 5 lines]
>
> Is there a way to examine the CSV file within Word?

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.