msword mail merge formula

I know how to make a mail merge using vb.net with msword my problem is this.. I need to read in a text file take the info from column 2 and change it and then put it into the mailmerge as a different name then what it was called in the datafile.  So how do you read in data from a file change 1 column of data to something else then put into a document as a different name than what it was called in the datafile???
ConnexusDaveAsked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
Unfortunately there isn't a 'substring' function in Word fields. Also Date arithmetic is not impossible but is very difficult.

It would be fairly simple in VB or VBA to create a new input file from the original with the firld as you require them.

strFirstName = Split(strFullname, " ")(0)

newdate = Dateadd("d", 10, olddate)
0
 
GrahamSkanRetiredCommented:
It isn't clear whether you want to change the name of the field (column), or to change the actual text as it is put into the document.

In ether case, it might be easiest to modify the input document.

For changing the field name, the most obvious thing to do would be to use the same names in the MERGEFIELDs as the column headers.

If this cannot be done some reason, you could have separate header file.

To change the text at the merge time is rather more difficult, and depends on what you want to change it into. You could choose to look for particular incoming text and change that with an IF field. Like this:

{ IF { MERGEFIELD myfield1 } = "some text" "new text"  { MERGEFIELD myfield1 } )
0
 
ConnexusDaveAuthor Commented:
one field is the full name (first, middle and last.). I only want the first name from this mergefield
second field is a date that I need to add 10 days to..

0
 
ConnexusDaveAuthor Commented:
Thanks much
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.