More than one formatting switch for a merge field

S

sch06

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.
 
D

Doug Robbins - Word MVP

It would be easier to give you the information that you are asking for if
you said:

1. What it is the datasource
2. How the information appears in the data source
3. How you want it to appear

--
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
 
S

sch06

1. The datasource is .xls
2. It was originally imported from AS400 and so all the fields are text
fields
3. However I need some of them to appear as currency with dollar signs,
commas, two places after decimal points. Also, if the merge field isn't
blank, I need text to appear before it.

I had tried just importing the datasource via DDE (would have solved both
problems since I would have only needed the \b switch), but my computer
freezes everytime I merge when using that method. And I have plenty of RAM,
so I'm not sure what the problem is there.
Thanks!
 
S

sch06

Thanks, I had consulted that site as well as this one already but couldn't
find anything on either about using two switches for one mergefield and
proper order for doing so.
 
D

Doug Robbins - Word MVP

As the \b switch inserts a POSTNET bar code, I can't imagine what it is that
you are trying to do. As far as the text before a field if it is not
blank, you should be using an { IF } field construction for that.

--
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
 
P

Peter Jamieson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top