View Single Post
  #12   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Problem Maintaing Excel Format after Mail Merge

Hi Mike,

Try:
{IF{MERGEFIELD Field2 \*Upper}= "H" {Mergefield Field1 \# ",0.0"} {IF{MERGEFIELD Field2 \*Upper}= "D" {Mergefield Field1 \@
"dd-MMM-yy"} {Mergefield Field1 \# ",0"}}}

--
Cheers
macropod
[MVP - Microsoft Word]


"Mike" wrote in message ...
Hi Graham,

Thanks for your sample syntax. It worked. I have one more question on this
matter though. The syntax worked when the IF testing contains only 2
criteria, like the problem in my first example, if =H, then it is "0.0" and
all others "0".

However, I got one more field that requires more than one testing criteria,
as follow:

Field 1 Field 2
18-Aug-08 D
2.1 H
2 U

Now, my test condition require IF Field 2=D, then Field 1 format must be
date, and IF Field 2=H, then the format must be "0.0" and the rest will be
"0.0".

Hope you can give me a clue how to write the syntax for such condition.

Thanks and regards,
Mike


"Graham Mayor" wrote:

{ IF { MERGEFIELD Field2 \*Upper} = "H" "{ Mergefield Field1 \# ",0.0" }"
"{ Mergefield Field1 \# ",0" }"}
The comma in the switches is the (optional) thousands separator.
--

Graham Mayor - Word MVP

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




Mike wrote:
Hi Graham,

I have this perculiar requirement that after merging the document, I
need the Field 1 decimal point to be as such that when Field 2=H, the
decimal format should be "0.0", and no decimal point for anything
other than H in Field 2. Can you suggest a conditional formating
formula that I should use in this case?

Field 1 Field 2
3 D
2.3 H
4 U
5 C

Regards,
Mike

"Graham Mayor" wrote:

DDE is at best a flaky method of connection to a data source which
is the reason it was abandoned as the default from Word 2002.
Ultimately it would be better to configure your data source properly
to avoid the problem in the first place, or to use conditional
fields to ensure that the correct data is applied - see also
http://www.gmayor.com/formatting_word_fields.htm

--

Graham Mayor - Word MVP

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



Mike wrote:
Dear macropod,

Haven't try this yet, but tried the DDE method suggested by Doug
Robbins. It worked, but have some problems if the files are stored
in the server.

Anyway, thanks for your suggestion.

Regards,
Mike

"macropod" wrote:

Hi Mike,

The fact that there are different kinds of data in the fields
doesn't prevent formatting switches being used. At most you'll need
an IF test. For example: {IF{MERGEFIELD Data \@ "dd-MM-yy"}=
"??-??-??" {MERGEFIELD Data \@ "dd-MM-yy"} {MERGEFIELD Data \#
",0.00"}}

Note: The field brace pairs (ie '{ }') for the above example are
created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[MVP - Microsoft Word]


"Mike" wrote in message
...
How do I keep the display result in Mail Merge to follow exactly
the format set in the Excel file?

I cannot use the format switches due to the same field in the
excel file contains multiple format, ie. the same field contains
data like date and numbers, i need the display result in Word to
show both dates and numbers.