View Single Post
  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default More than one formatting switch for a merge field

Can I use more than one switch for a merge field,

Usually.

and if so, is there a
proper order I must use?


In some cases. (There are one or two switches that have to go at the end,
but otherwise, sequence does not usually matter)

Currently I'm trying to use the \# and \b
switches. It's showing the \b text, but not formatting the numbers when I
merge.


Imagine you apply the \b switch. Then the \# operates on the result, as far
as I know. So if myfield contains 1.234,

{ MERGEFIELD myfield \#0.0 }

should give you 1.2

{ MERGEFIELD myfield \b "myfield: " }

should give you

myfield: 1.234

but when you apply \#0.0 to "Number: 1.234", the switch actually ignores the
non-numeric characters and gives you 1.2. So both switches are being
applied, but not with the effect you probably hoped for, i.e. that the \# is
applied first and the \b after.

If that is what you want, then what to do depends on exactly whan can be in
myfield and how you want it displayed. For example, suppose myfield could
have the following types of content:
1. numeric, non-zero, e.g. 1.234
2. numeric, zero, e.g. 0
3. blank (could come from a numeric column where Word or the data source has
not substitued a "0"), i.e. ""
4. nonblank, non-numeric, e.g. "abc"

Using \b and \# suggests you want the following:

1. myfield: 1.2
2. myfield: 0
3. (blank)
4. myfield: abc

To get that, you will probably have to use a nested IF field (sorry, no time
for an example right now!)

If you just want 1,2, and 3 (i.e. you know the value is numeric or blank)
you can probably use

{ MERGEFIELD myfield \#"'myfield: 0.0'" }

Peter Jamieson

"sch06" wrote in message
...
Can I use more than one switch for a merge field, and if so, is there a
proper order I must use? Currently I'm trying to use the \# and \b
switches. It's showing the \b text, but not formatting the numbers when I
merge.