A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Substitute a word/character in the mergefield result



 
 
Thread Tools Display Modes
  #1  
Old April 9th, 2010, 04:33 PM posted to microsoft.public.word.mailmerge.fields
P. Anderson[_2_]
external usenet poster
 
Posts: 3
Default Substitute a word/character in the mergefield result

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

  #2  
Old April 9th, 2010, 05:25 PM posted to microsoft.public.word.mailmerge.fields
P. Anderson[_2_]
external usenet poster
 
Posts: 3
Default Substitute a word/character in the mergefield result

An additional note to the question, I am using Word 2007 to merge in
document information from ODBC datasource.

"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

  #3  
Old April 9th, 2010, 05:49 PM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.