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 / Mailmerge and Fax / August 2007

Tip: Looking for answers? Try searching our database.

Using IF to add a character

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Asinger - 14 Aug 2007 23:42 GMT
I'm not sure if an IF rule is the right way to do this. I am creating a
Directory Merge, a list of names/addresses/phones/email. Some people have
more than one phone (e.g., home and cell). I would like the phones to be on
the same line, formatted as follows:

505-555-5555 / 505-555-6666

I right clicked the merge field for the second phone number shown above and
chose Edit Field. I selected the "Text to be inserted after:" check box and
entered space / space (where "space" is an actual space, not the word space).
This works great as long as there is always a value in the first phone number
field (I thought there would be but I have some records where there is only a
cell, the second phone number field, and no home phone, the first phone
number field). So instead of looking like the above example, I get this in
that case:

/ 505-555-6666

I think I need to add the spaces and slash after the first phone number
field, but I only want those characters to be used when the second phone
number field is not blank. Is that right? If so, can someone help me with
formatting the IF rule?

PART 2: What is the difference with inserting rules using the Rules
drop-down in the Ribbon versus right clicking a merge field and choosing Edit
Field? When should I use one over the other - or does it matter?

Thanks!
Doug Robbins - Word MVP - 15 Aug 2007 00:13 GMT
Use the following field construction:

{ IF { MERGEFIELD Home } <> "" "{ IF { MERGEFIELD Cell } <> "" "{ MERGEFIELD
Home } / { MERGEFIELD Cell }" "{ MERGEFIELD Home }" }" "{ MERGEFIELD
Cell }" }

You must use Ctrl+F9 to insert each pair of field delimiters { } and you use
Alt+F9 to toggle off their display.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> I'm not sure if an IF rule is the right way to do this. I am creating a
> Directory Merge, a list of names/addresses/phones/email. Some people have
[quoted text clipped - 31 lines]
>
> Thanks!
Asinger - 15 Aug 2007 00:58 GMT
Doug - I understand about using Ctrl-F9 to produce the brackets. When I do
that, Word auto-inserts two spaces so that if I begin typing, my entry is
preceded and ended with a space (after/before open/close brackets). Your
entry seems to have the spaces too - can you just confirm for me that the
spaces are necessary? Also, do I type this directly in my merge document, and
where should I type it with respect to the merge fields? Thanks very much.
April

> Use the following field construction:
>
[quoted text clipped - 40 lines]
> >
> > Thanks!
Graham Mayor - 15 Aug 2007 06:45 GMT
The spaces are not *required*, but as Word's insert field adds them, they
are best inserted for standardisation (e.g. you may wish to use replace on a
document so it helps if all are inserted the same way).
i.e.
{ MERGEFIELD Home }
and
{MERGEFIELD Home}
will both work equally well.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Doug - I understand about using Ctrl-F9 to produce the brackets. When
> I do that, Word auto-inserts two spaces so that if I begin typing, my
[quoted text clipped - 57 lines]
>>>
>>> Thanks!
Peter Jamieson - 15 Aug 2007 09:32 GMT
Just to add a couple of obscure details to Graham's comment
a. in the very early versions of Windows Word, Word did /not/ insert those
extra spaces automatically. I think those extra spaces arrived in Word 6.
a. there are at least two places where having a space before the closing
brace makes a difference:

{ MACROBUTTON mymacro mytext }blah
displays
mytext blah

whereas

{ MACROBUTTON mymacro mytext}blah
displays
mytextblah

and similarly

{ EQ \l(1,2,3) }blah
displays
1,2,3 blah

whereas
{ EQ \l(1,2,3)}blah
displays
1,2,3blah

There could be others, but for example SET and QUOTE fields do not behave
this way.

Peter Jamieson

> Doug - I understand about using Ctrl-F9 to produce the brackets. When I do
> that, Word auto-inserts two spaces so that if I begin typing, my entry is
[quoted text clipped - 57 lines]
>> >
>> > Thanks!
 
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.