View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Substitute a word/character in the mergefield result

1. Ideally, make the substitution in your data source (what is it, and
which version of Word are you using? I ask because it is just possible
that you could issuse SQL that would do the appropriate REPLACE, but if
for example you data source uses the Jet engine (e.g. is Access or
Excel) that won't work.

2. If
a. it's always a comma and
b. you can guarantee that there are no unhelpful characters (such as
")" ) in the field and
c. you can guarantee that the standard list separator in regional
options (in control panel) is a comma, then one possibility would be to
use a nested EQ field (e.g.

{ EQ \a({ MERGEFIELD myfield })}

(in other words, the string should not contain stuff that the EQ field
would misinterpret). Each pair of {} needs to be the special field code
braces that you can insert using ctrl-F9

3. Since (2) is probably a tall order, the other "standard" way to do it
would be to use VBA and Word's Mailmerge events to replace all the
commas by CRLFs and either insert the resulting text directly or use a
DOCVARIABLE field to do it. But let us know if you need to do that.


Peter Jamieson

http://tips.pjmsn.me.uk

On 09/04/2010 16:33, P. Anderson wrote:
I would like to be able to substitue any comma from a {Mergefield field}
result to a return character. Then the Mergefield result "box, top,
carrot, onion" would look like

box
top
carrot
onion

Thank you
P. Anderson