I tried it and I'm getting a result of 0.0, but I noticed two inconsistencies
in your code:
1) you have one too many right brackets "}"
2) on your "SET m" line, there are two closing brackets without opening
brackets "))"
> it would replace whatever merge field codes you are using now in your Word
> document.
[quoted text clipped - 35 lines]
> >> > is
> >> > too high. Is there a fix for this?
Doug Robbins - Word MVP - 08 May 2007 15:14 GMT
The correct field construction is:
{ SET x { MERGEFIELD mylargenumber }}{ SET r { =MOD(x,1000000) }}
{ SET m { =INT((x-r)/1000000) }}
{ IF { m } = 0 "" "{ m \*Cardtext } million "}{ r \Cardtext }

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 tried it and I'm getting a result of 0.0, but I noticed two
>inconsistencies
[quoted text clipped - 48 lines]
>> >> > is
>> >> > too high. Is there a fix for this?
Peter Jamieson - 08 May 2007 15:20 GMT
Yes, there should also be a * before the second "Cardtext". Try:
{ SET x { MERGEFIELD mylargenumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT((x-r)/1000000)) }
}{ IF { m } = 0 "" "{ m \*Cardtext } million " }{ r \*Cardtext }
Other than that, it seems OK here - what values do you have in your
"mylargenumber" ?
What is the result of { x } ?
Peter Jamieson
>I tried it and I'm getting a result of 0.0, but I noticed two
>inconsistencies
[quoted text clipped - 48 lines]
>> >> > is
>> >> > too high. Is there a fix for this?
Todd K. - 08 May 2007 16:28 GMT
Wow, thank you all so much. I actually made a couple of other changes, as
this is for dollars and needed to be in all capitals, so my final code looks
like this:
{ SET x { MERGEFIELD mylargenumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT((x-r)/1000000) }
}{ IF { m } = 0 "" "{ m \*Cardtext\*Upper } MILLION" }{ r
\*Dollartext\*Upper }
But it works great. Kudos to you.
> Yes, there should also be a * before the second "Cardtext". Try:
>
[quoted text clipped - 62 lines]
> >> >> > is
> >> >> > too high. Is there a fix for this?
Graham Mayor - 08 May 2007 15:25 GMT
It is very easy to make minor mistakes in transposing fields to text strings
but what I suspect Peter really meant was
{ SET x { Mergefield MyLargeNumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT((x-r)/1000000) }
}{ IF{ m } = 0 "{=INT({ r })\*Cardtext }" "{ =INT({ m }) \*Cardtext }
million " }
This works for me (for integers). To aid the copying of field construction
to text use the macro at http://www.gmayor.com/export_field.htm. That way
you don't get the mistakes ;)
If you have decimals with the numbers (or these are currency amounts) then
further calculations will be required.- see the section formatting cash
amounts in words at http://www.gmayor.com/formatting_word_fields.htm

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> I tried it and I'm getting a result of 0.0, but I noticed two
> inconsistencies in your code:
[quoted text clipped - 41 lines]
>>>>> is
>>>>> too high. Is there a fix for this?