Hi John,
You could perform an IF test on your mergefields to achieve the desired
result. For example:
{IF{DATE \@ yyyyMMdd}= {MERGEFIELD MyDate \@ yyyyMMdd} "{MERGEFIELD MyAmount
\# $,#} on {MERGEFIELD MyDate \@ MM/dd/yyyy}" "{MERGEFIELD MyAmount \# $,#}
on {MERGEFIELD MyDate \@ MM/dd/yyyy}"}
where the first set of mergefields is formatted with the yellow colour and
'MyDate' and 'MyAmount' are the names of your mergefields.
If you want to control the colouring of the date and amount results
independently of each other, you could use:
{IF{DATE \@ yyyyMMdd}= {MERGEFIELD MyDate \@ yyyyMMdd} {MERGEFIELD MyDate \@
MM/dd/yyyy} {MERGEFIELD MyDate \@ MM/dd/yyyy}}
for the date; and
{IF{DATE \@ yyyyMMdd}= {MERGEFIELD MyDate \@ yyyyMMdd} {MERGEFIELD MyAmount
\# $,#} {MERGEFIELD MyAmount \# $,#}}
for the amount.
The field coding works by comparing today's date in ISO format against the
merged date, also in ISO format. The results of this comparison determines
whether the output should be displayed in yellow.
You could extend this to cater for amounts that are overdue, like:
{IF{DATE \@ yyyyMMdd}> {MERGEFIELD MyDate \@ yyyyMMdd} "{MERGEFIELD MyAmount
\# $,#} on {MERGEFIELD MyDate \@ MM/dd/yyyy}" {IF{DATE \@ yyyyMMdd}=
{MERGEFIELD MyDate \@ yyyyMMdd} "{MERGEFIELD MyAmount \# $,#} on {MERGEFIELD
MyDate \@ MM/dd/yyyy}" "{MERGEFIELD MyAmount \# $,#} on {MERGEFIELD MyDate
\@ MM/dd/yyyy}"}}
where the first set of mergefields is formatted with say, red, and the
second set of mergefields is formatted yellow.
Cheers
PS: the field braces (i.e. '{ }') are created in pairs via Ctrl-F9 - you
can't use normal braces for this.
--
macropod
[MVP - Microsoft Word]
John in Saratoga said:
I am mailmerging into a word document a text field such as this:
Due: $100 on 11/5/2006; $120 on 12/6/2006; $80 on 1/5/2007
If one of the dates meets a certain criteria, e.g., if it is within the
current month, I want to highlight that date and its associated amount
yellow.
Any ideas how to highlight or apply a style to only part of a mailmerge
field's content based on that content?
Any suggestions appreciated.