Code:
```FUNCTION fValue2Words ALIAS "fValue2Words" ( BYVAL Number AS CUX ) EXPORT AS STRING

DIM Cents  AS LOCAL  LONG
DIM I      AS LOCAL  LONG
DIM Nbr    AS LOCAL  STRING * 15
DIM N_ptr  AS STRING PTR    *  3
DIM Poff   AS LOCAL  LONG
DIM Temp   AS LOCAL  STRING
DIM Thou   AS LOCAL  LONG
DIM V      AS LOCAL  LONG

'-----------------------------------------------------------------------------
DATA "ONE "        , "TWO "     , "THREE "   , "FOUR "     : ' numeric values
DATA "FIVE "       , "SIX "     , "SEVEN "   , "EIGHT "    : '
DATA "NINE "       , "TEN "     , "ELEVEN "  , "TWELVE "   : '
DATA "THIRTEEN "   , "FOURTEEN ", "FIFTEEN " , "SIXTEEN "  : '
DATA "SEVENTEEN "  , "EIGHTEEN ", "NINETEEN ", "TWENTY"    : '
DATA "THIRTY"      , "FORTY"    , "FIFTY"    , "SIXTY"     : '
DATA "SEVENTY"     , "EIGHTY"   , "NINETY"   , "HUNDRED "  : '
DATA "THOUSAND "   , "MILLION " , "BILLION " , "TRILLION " : ' 29, 30, 31, 32
DATA "DOLLAR "     , "DOLLARS " , "AND "                   : ' 33, 34, 35
DATA "CENT"        , "CENTS"    , "00 "                    : ' 36, 37, 38
'-----------------------------------------------------------------------------

Cents  = ( 100 * FRAC( Number) )                        ' store the decimals
IF Number < 1 THEN                                      ' if no whole numbers
END IF                                                  '
Nbr   = RSET\$(STR\$(FIX(Number)),15)                     ' convert value to string
N_ptr = VARPTR(Nbr)                                     ' set the pointer
Thou  = 33                                              ' TRILLION data pos
'-------------------------------------------------------'
FOR Poff = 0 TO 4                                       ' each 3 digit pos
DECR Thou                                             '  back off TRILLIONs
V = VAL( @N_ptr[Poff] )                               '  value of 3chars
IF V = 0 THEN ITERATE                                 '  nada!
IF V > 99 THEN                                        '  if hundreds pos
I = ( V  \  100 )                                   '   # of hundreds
V = ( V MOD 100 )                                   '   remainder 100
END IF                                                '
IF ( V > 19 ) THEN                                    ' tens (21 is lowest)
I    = ( V  \  10 )                                 '  # of tens
V    = ( V MOD 10 )                                 '  strip tens
Temp = Temp & IIF\$(V>0,"-",\$SPC)                    '  hyphen or space!
END IF                                                '
IF V > 0 THEN Temp = Temp & READ\$(V)                  '  add more words
IF Poff < 4 THEN Temp = Temp & READ\$(Thou)            '  thousands/mills/etc
NEXT                                                    '
'-------------------------------------------------------'
AddCents:                                               ' clean up & finish
I = IIF(Number = 1,33,34)                             '  DOLLARS or DOLLAR
V = IIF(Cents  = 1,36,37)                             '  CENTS   or CENT
Temp = Temp & READ\$(I) & READ\$(35)  _                 '  tack on "DOLLARS AND"
& FORMAT\$(Cents,"00 ")  _                 '  tack on "nn "
& READ\$(V)                                '  tack on "CENTS"
'-------------------------------------------------------'
FUNCTION = Temp                                         ' RETURN the string

END FUNCTION```
------------------
C'ya
Don
[email protected]

[This message has been edited by Don Schullian (edited September 17, 2003).]