Results 1 to 12 of 12
  1. #1
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have tried out the field expression {=123 * .8 \*DollarText} in vain.
    Word always complains Error!Number cannot be represented in specified format.
    What's wrong with the expression? Please help. Thanks.
    Armstrong

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    [quote name='armsys' post='795992' date='02-Oct-2009 17:36']I have tried out the field expression {=123 * .8 \*DollarText} in vain.
    Word always complains Error!Number cannot be represented in specified format.
    What's wrong with the expression?[/quote]
    Do you want the result in dollars? If so try this {=123*.8 \# "$#,##0.00;($#,##0.00)"}
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='Andrew Lockton' post='795996' date='02-Oct-2009 16:37']Do you want the result in dollars? If so try this {=123*.8 \# "$#,##0.00;($#,##0.00)"}[/quote]
    Hi Andrew,
    No, I'm looking for dollar text /*DollarText. Sorry.
    Armstrong

  4. #4
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Word appears to impose a limit on the number it can translate into a dollar text.
    { = 1234567 * 4 \* DollarText \* Upper } fails.
    { = 123456 * 4 \* DollarText \* Upper } displays "FOUR HUNDRED NINETY-THREE THOUSAND EIGHT HUNDRED TWENTY-FOUR AND 00/100."
    Armstrong

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The limit is 999,999.99.

    Your original example works fine when I try it.

  6. #6
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='796002' date='02-Oct-2009 17:49']The limit is 999,999.99.

    Your original example works fine when I try it.[/quote]
    I've never come across any Microsoft document revealing the limit. HansV, thanks a lot.
    Which "original example" works?
    Thanks.
    Armstrong

  7. #7
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is it possible to augment the 999,999.99 limitation?

    Armstrong

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='armsys' post='796004' date='02-Oct-2009 11:55']Which "original example" works?[/quote]
    The one from the subject of this topic: {=123 * .8 \*DollarText}:

    [attachment=85784:x.png]
    Attached Images Attached Images
    • File Type: png x.png (1.2 KB, 3 views)

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='armsys' post='796005' date='02-Oct-2009 11:57']Is it possible to augment the 999,999.99 limitation?[/quote]
    You could use formfields and VBA code, see Spell Out Currency on Greg Maxey's website.

  10. #10
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='796009' date='02-Oct-2009 18:30']You could use formfields and VBA code, see Spell Out Currency on Greg Maxey's website.[/quote]
    HansV,
    I often visit Greg's website, but didn't know he wrote an article on dollar text.
    Thanks a lot.
    Armstrong

  11. #11
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    [quote name='armsys' post='796005' date='02-Oct-2009 19:57']Is it possible to augment the 999,999.99 limitation?

    Armstrong[/quote]
    Hi Armstrong,

    Try:
    {QUOTE {ASK Val "What is he amount, in digits?"}
    {SET AbsVal {=ABS(Val)}}
    {IF{=Val}< 0 "Minus "}
    {IF{=INT(AbsVal/100000000)}<> 0 "{=INT(AbsVal/100000000) \*Cardtext} hundred "}
    {IF{=MOD(INT(AbsVal/1000000),100)} <> 0 "{IF{=INT(AbsVal/100000000)}<> 0 "and "}"}
    {IF{=INT(AbsVal/1000000)}<> 0 "{=MOD(INT(AbsVal/1000000),100) \*Cardtext} million, "}
    {IF{=INT(AbsVal/100000)}<> 0 "{=MOD(INT(AbsVal/100000),10) \*Cardtext} hundred "}
    {IF{=MOD(INT(AbsVal1000),100)} <> 0 "{IF{=INT(AbsVal/100000)}<> 0 "and "}"}
    {IF{=INT(AbsVal/1000)}<> 0 "{=MOD(INT(AbsVal/1000),100) \*Cardtext} thousand, "}
    {IF{=MOD(INT(AbsVal/100),10)}<> 0 "{=MOD(INT(AbsVal/100),10) \*Cardtext} hundred "}
    {IF{=MOD(INT(AbsVal),100)}<> 0 "{IF{=INT(AbsVal/100)}<> 0 "and "}{=MOD(INT(AbsVal),100) \*Cardtext} "}
    {=INT(AbsVal) \# \dollar;;}{IF{=INT(AbsVal)}> 1 "s"}
    {IF{=MOD(AbsVal,1)}<> 0 "{IF{=INT(AbsVal)}<> 0 " and "}{=MOD(AbsVal,1)*100 \*Cardtext} cent{IF{=MOD(AbsVal,1)}> 0.01 s}"} \* FirstCap}

    This will let you go as high as 999,999,999.99, returning "Nine hundred and ninety-nine million, nine hundred and ninety-nine thousand, nine hundred and ninety-nine dollars and ninety-nine cents". High enough? Actually, you can go higher still (eg 99,999,999,999.99) but the text expression for the higher orders of magnitude aren't quite right - a bit more code could be introduced for that - but only if it was really needed.

    Note that the expression also includes 'and ' in various places, per UK/Aus English.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  12. #12
    3 Star Lounger
    Join Date
    Mar 2009
    Location
    Hong Kong
    Posts
    359
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Paul,
    I prefer your field approach. You're my "field" hero/guru. Everyday I study your articles on fields. Not everything (such as number of days between two dates) you wrote about I could understand right away. It just takes time. Thank you for writing the code which involves tons of field manipulation techniques.
    Armstrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •