Public Function SpellCurrency( _ ByVal vDollars As Variant _ , Optional ByVal vSpellTheCents As Variant _ , Optional ByVal vUSEnglish As Variant _ ) As Variant
SpellCurrency(34.23, False) = "Thirty-four and 23/100 Dollars" SpellCurrency(34.23, True) = "Thirty-four Dollars and Twenty-three Cents"See also:
SpellCurrencySample Subroutine SpellThreeDigitInteger Function SpellNumber FunctionNote: Function needs to be extended to handle the (US and UK) English "spelling" of other foreign currencies.
vDollars: The number representing currency which is to be spelled. Function returns Null if vDollars is Null.
Function returns an empty string if vDollars is non-numeric (if it cannot be fixed up to a currency amount).
Note: Function only handles values between -1E36 and 1E36 exclusive. Function returns the string "Overflow" if vDollars is <= (less than or equal to) -1E36 (-1 * 10^36) or >= (greater than or equal to) 1E+36 (1 * 10^36).
vSpellTheCents: If True, hundredths of dollars are spelled as in "... Dollars and Twenty-three Cents" If False, hundredths of dollars are rendered as a fractional expression as in "... and 23/100 Dollars" vSpellTheCents defaults to False (Cents represented as fractions) if vSpellTheCents is missing or Null or cannot be fixed up to a number.
vUSEnglish: If True, large numeric amounts are spelled using Unites States English words such as Thousand, Million, Billion, Quadrillion, etc. If False, large numeric amounts are spelled using United Kingdom English words such as Thousand, Million, Milliard , Billion, etc. vUSEnglish defaults to True (US English words used) if it is missing or Null or cannot be fixed up to a number.
v1.3 BugFix: Fixed a bug in this function that caused it to print an incorrect amount in some cases when the common logarithm of the dollar amount vDollars was an exact multiple of three (for example, for $1,000, $1,000,000, etc.)
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.