Examine the number three digits at a time. Translate each three-digit group into words and add the appropriate ending as in "twenty two thousand."
Function Words_1_999 returns a string for a number between 1 and 999. It pulls off the hundreds digit and evaluates it if it is non-zero using function Words_1_19. It then uses function Words_1_99 to evaluate the remainder (tens and ones digits) which form a number between 1 and 19.
Function Words_1_19 uses a Select Case statement to convert numbers between 1 and 19 into words.
Function Words_1_99 determines whether the number is less than 20. If it is, the function uses Words_1_19 to find its string value.
If the number is greater than 19, the function examines the tens digit to get the appropriate string. It then uses Words_1_19 to find the appropriate word for the ones digit.
Function Words_1_all uses these other functions to calculate the value for the entire number. It makes an array of grouping endings: thousand, million, and so forth. (Insert milliard, thousand million, etc. if you wish.) It then decides whether the number is greater than each group's smallest value and, if it is, uses Words_1_999 to calculate an appropriate string.
Function Words_Money breaks the number at the decimal point and converts the two pieces into dollars and cents. (You could change it to pounds, euros, or whatever).
|