Please send me any feedback...thanks
Please send me any feedback...thanks
Last edited by Hack; Feb 18th, 2007 at 06:02 AM.
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
My next challenge is to convert Numbers to VBscript. Why? To learn VBscript.
It is complex but not too complex to begin with. If you have ideas, please share them
Thanx
Before I download this... what EXACTLY does it do? Give an example, please.
You enter a number less than 66 digits and it converts it to words...
With full source code.
Based on what? How do the numbers relate to the words? A combination of character ascii codes, or... what? I guess what I'm trying to get at, is... what would this be useful for, and how would one use it?
That is a whole lot of code for what it does, though. And what exactly is the purpose of the opacity thing, or was that just to try it out or something?
The opaque? Just trying something. The code was written in 1985 for an Alpha Micro (Alpha Basic). I converted to Qbasic, and last month VB6
Interesting. I like the opacity thing. The form loaded with errors due to the missing icon, but it works otherwise.
The first number I entered was 29.5. Ouch!
Seems this is an integers-only number converter. I prefer mixed-company numbers myself! Are ya up for the challenge???![]()
I did not include the Icon? I'll check that.
As for for the 29.5, R U up for the challenge ?
Naw.
If code has GOTOs in it not involving error handling, I GOTO something else.
It saves lots of hair-pulling and frustration.
But thanks anyway.
Last edited by rjbudz; Jan 26th, 2007 at 04:15 PM.
Goto's are generally bad, in my opinion. I rarely(and I mean RARELY) use them. If you can avoid them, do so. And in almost every case, they ARE avoidable. It's just bad programming practice, in my honest opinion.Originally Posted by rjbudz
God put me on this earth to do many great things, and I'm so far behind that I'm going to live forever.
I'm programming for Windows using a Apple Mac Mini, 1.5Ghz with 512MB DDR RAM. I feel like I'm committing a crime :P
People, I simply converted the code from another OS...
If you like it, send me a point or two.
Smiles
This thread has really been bugging me. I guess maybe it was the challenge. Anyway, I had to get this code out of my head and into my machine.
I feel better now.
I didn’t spend much time streamlining the code. Nor was I shooting for elegance. I’m sure it can be fine tuned. I just wanted to get it functional.
This code does what is advertised, but only up to 28 digits. After that the values automagically convert to scientific notation. I'm sure there is a way past this, and I've set the program up to process values up to 10^100 (a centillion or a googol, depending on who you ask).
Numbers are infinite, but computer mathematics and my patience are not. There is, thankfully, a limit as to how far one can go with this. Myself, I have no interest in going further than named numbers.
But I am interested to know what’s wrong, and fixing it.VB Code:
' Returns in english words any decimal value entered up to 28 digits. ' (Assumes U.S. numbering system) ' You'll need three text boxes: ' txtEntry ' txtFormattedEntry ' txtResult ' make this one big, with multiLine = True ' And one buton ' cmdProcess Option Explicit Private SuffixArray(35) As String Private Sign As String Private Sub cmdProcess_Click() Dim DecimalLoc As Integer Dim DecimalPart As String Dim WholeNumberPart As String Dim VerifiedNumber As String Dim x As Integer Dim y As Integer Dim Result As String Dim LeftDigit As String Dim MiddileDigit As String Dim RightDigit As String ' clear old stuff txtResult.Text = "" txtFormattedEntry.Text = "" ' make sure it's a number VerifiedNumber = ValidateNumber ' if it's not a valid number then get out If Len(VerifiedNumber) = 0 Then MsgBox "Text entry is not numeric.", vbExclamation, "" Exit Sub End If ' limit of unknown origin If Len(VerifiedNumber) > 28 Then MsgBox "Number entered its too large.", vbExclamation, "" Exit Sub End If ' number names Call InitializeSuffixArray ' split up number if decimal point DecimalLoc = InStr(VerifiedNumber, ".") If DecimalLoc > 0 Then WholeNumberPart = Left(VerifiedNumber, DecimalLoc - 1) DecimalPart = Right(VerifiedNumber, Len(VerifiedNumber) - DecimalLoc) Else WholeNumberPart = VerifiedNumber If Len(WholeNumberPart) = 0 Then Exit Sub End If ' process whole numbers first ' pad with zeros (so there will always be a Left, Middle and Right digit) Do Until Len(WholeNumberPart) Mod 3 = 0 WholeNumberPart = "0" & WholeNumberPart Loop ' determine how many groups there are (for SuffixArray) y = Len(WholeNumberPart) / 3 ' determine how many groups we need For x = 1 To Len(WholeNumberPart) Step 3 LeftDigit = Mid(WholeNumberPart, x, 1) MiddileDigit = Mid(WholeNumberPart, x + 1, 1) RightDigit = Mid(WholeNumberPart, x + 2, 1) If LeftDigit <> "0" Then Result = Result & Ones(LeftDigit) & " Hundred" If MiddileDigit = 1 Then Result = Result & Tens(MiddileDigit & RightDigit) Else Result = Result & Tens(MiddileDigit) Result = Result & Ones(RightDigit) End If Result = Result & SuffixArray(y) y = y - 1 Next ' now the Decimal part If Len(DecimalPart) > 0 Then Result = Result & " Point" For x = 1 To Len(DecimalPart) If Mid(DecimalPart, x, 1) <> "0" Then Result = Result & Ones(Mid(DecimalPart, x, 1)) Else Result = Result & " Zero" End If Next End If ' ta da! txtResult.Text = Trim(Sign & Result) ' show the entry properly formatted so the result is easier to verify txtFormattedEntry = Sign & Trim(Format(VerifiedNumber, "#,###") & "." & DecimalPart) End Sub Private Sub InitializeSuffixArray() ' Number names from: [url]http://www.unc.edu/~rowlett/units/large.html[/url] SuffixArray(1) = "" SuffixArray(2) = " Thousand" ' 10^3 SuffixArray(3) = " Million" ' 10^6 SuffixArray(4) = " Billion" ' 10^9 SuffixArray(5) = " Trillion" ' 10^12 SuffixArray(6) = " Quadrillion" ' 10^15 SuffixArray(7) = " Quintillion" ' 10^18 SuffixArray(8) = " Sextillion" ' 10^21 SuffixArray(9) = " Septillion" ' 10^24 SuffixArray(10) = " Octillion" ' 10^27 ' SuffixArray(12) = " Nonillion" ' 10^30 ' SuffixArray(13) = " Decillion" ' 10^33 ' SuffixArray(14) = " Undecillion" ' 10^36 ' SuffixArray(15) = " Duodecillion" ' 10^39 ' SuffixArray(16) = " Tredecillion" ' 10^42 ' SuffixArray(17) = " Quattordecillion" ' 10^45 ' SuffixArray(18) = " Quindecillion" ' 10^48 ' SuffixArray(19) = " Sexdecillion" ' 10^51 ' SuffixArray(20) = " Septendecillion" ' 10^54 ' SuffixArray(21) = " Octodecillion" ' 10^57 ' SuffixArray(22) = " Novemdecillion" ' 10^60 ' SuffixArray(23) = " Vigintillion" ' 10^63 ' SuffixArray(24) = " unvigintillion" ' 10^66 ' SuffixArray(25) = " duovigintillion" ' 10^69 ' SuffixArray(26) = " trevigintillion" ' 10^72 ' SuffixArray(27) = " quattuorvigintillion" ' 10^75 ' SuffixArray(28) = " quinvigintillion" ' 10^78 ' SuffixArray(29) = " sexvigintillion" ' 10^81 ' SuffixArray(30) = " septenvigintillion" ' 10^84 ' SuffixArray(31) = " octovigintillion" ' 10^87 ' SuffixArray(32) = " novemvigintillion" ' 10^90 ' SuffixArray(33) = " trigintillion" ' 10^93 ' SuffixArray(34) = " untrigintillion" ' 10^96 ' SuffixArray(35) = " duotrigintillion" ' 10^99 End Sub Private Function Ones(ByVal Digit As String) As String Select Case Digit Case "0": Ones = "" Case "1": Ones = " One" Case "2": Ones = " Two" Case "3": Ones = " Three" Case "4": Ones = " Four" Case "5": Ones = " Five" Case "6": Ones = " Six" Case "7": Ones = " Seven" Case "8": Ones = " Eight" Case "9": Ones = " Nine" End Select End Function Private Function Tens(ByVal Digit As String) As String If Len(Digit) = 2 Then Select Case Digit Case "10": Tens = " Ten" Case "11": Tens = " Eleven" Case "12": Tens = " Twelve" Case "13": Tens = " Thirteen" Case "14": Tens = " Fourteen" Case "15": Tens = " Fifteen" Case "16": Tens = " SixTeen" Case "17": Tens = " Seventeen" Case "18": Tens = " Eighteen" Case "19": Tens = " Nineteen" End Select Else Select Case Digit Case "0": Tens = "" Case "1": Tens = " Ten" Case "2": Tens = " Twenty" Case "3": Tens = " Thirty" Case "4": Tens = " Fourty" Case "5": Tens = " Fifty" Case "6": Tens = " Sixy" Case "7": Tens = " Seventy" Case "8": Tens = " Eighty" Case "9": Tens = " Ninety" End Select End If End Function Private Function ValidateNumber() As String Dim NextChar As String Dim OutputText As String Dim FirstDecinalPoint As Boolean Dim TrimmedEntry As String Dim x As Integer ' check for negative number TrimmedEntry = Trim(txtEntry.Text) ' determine positive or negative. Sign is global If Left(TrimmedEntry, 1) = "-" Then Sign = "Negative" TrimmedEntry = Right(TrimmedEntry, Len(TrimmedEntry) - 1) Else Sign = "" End If ' only one decimal point allowed FirstDecinalPoint = True ' check each character of entry For x = 1 To Len(Trim(TrimmedEntry)) NextChar = Mid(Trim(TrimmedEntry), x, 1) If IsNumeric(NextChar) Or (FirstDecinalPoint = True And NextChar = ".") Then If NextChar = "." Then FirstDecinalPoint = False OutputText = OutputText & NextChar Else If NextChar <> "," Then ValidateNumber = "" Exit Function End If End If Next ' remove leading and trailing zeros ValidateNumber = Format(OutputText, "General Number") End Function
I am just happy that you liked it.
And I code old school...keep it small
The code should not really be all that long, to be honest. The names are the longest part of it, but you could get around that by saving them to a txt file and parsing them that way, rather than creating lines and lines of code. Generally, when I'm working with a structured setting like that(i.e. 10 = "Ten", 11 = "Eleven", or 10^3 = "Thousand", 10^6 = "Million", etc.), I'd create a database file to reference, rather than assigning values or variables for each one and referencing them that way. That's too much work, too many lines of code to keep track of. I'd rather just setup a file, and write a couple of lines to parse it accordingly. As far as searching the string, it would all be a matter of finding the reference point of how many numbers it contains(i.e. thousands, millions, billions, etc.), and converting the numbers to text according to the reference for each in the database.
God put me on this earth to do many great things, and I'm so far behind that I'm going to live forever.
I'm programming for Windows using a Apple Mac Mini, 1.5Ghz with 512MB DDR RAM. I feel like I'm committing a crime :P
B.D., To much work for this program.
From your profile, MAC and PC, look at http://www.realbasic.com/
I Ghosted my PC installed RB,...
Thanks for your input, guys. In my post, I did state that this was just code to get it to work. Not shooting for any prizes for least lines of code, efficiency or elegance here. Reading from text files (or creating a database to hold names) is beyond the scope and requirements of such a small, trivial application (It's less than 200 lines of code!).
It's just code to get the job done.![]()
This type of thing happens a lot in the real world. It's not recommended, but such is life.
Anyway, I was hoping for some help regarding the unexpected limitations.
Last edited by rjbudz; Feb 1st, 2007 at 12:57 PM.
... Of course it would be a lot of fun to create a Rube Goldberg* out of it!
* http://en.wikipedia.org/wiki/Rube_Goldberg_machine
Ok, I can tell by the vast amount of traffic and replies that this thread has been getting since I posted the new & improved version, and asked for assistance (tap, tap, tap, hello, is this thing on?) that everyone has been waiting with unbearable anticipation to know exactly what was wrong with my code.
So without further ado: I was converting the input string to a double to use Format(). I tore it out, and now it all works. Enter up to 102 digits into the application and zing-bam-zing you get the English equivalent.
What could you use it for, you ask?
Why writing checks of course!
So, just in case you want to pay off every debt that's ever been made, and any future ones for all mankind, you WILL need this app. Trust me on this!
RJ, I know you spent much time on this, and you still wrote in "New School"
Just append "teen" to the number ...etc
I am impressed you found numbers beyond 66 digits.
And if you want some to write some code, look at my "Text to Excel"...I need to add some user controls like ListView...interested?
I'll take a look. What's the link?
Convert Text To Excel
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
I looked. Please go to that thread and let me know what you need help with!
My version, handles the digits in groups of three or power of one thousand.
NumToWord(ByVal NumStr As String, [KiloDelimiter As String = ","], [Conversion As VbStrConv = vbProperCase]) As String
NumStr
- additional validation and string processing
- converted to integer array in groups of 3 starting with least significant digits
KiloDelimeter
- delimeter used on words grouped by power of thousand, default is comma
Conversion
- value passed on to StrConv()
Remarks:
- Sample implementation handled only converion to words of whole number part, decimal portion handling is left as case to case. Power_ToWord() can be used for negative powers of one thousand (eg. millionth) if you choose to handle the decimal portion that way.
One can always make a better mouse trap.
Like I said, a client wrote this in the eighties (84?) on an Alpha Micro (AlphaBasic).
While fixing several Y2K clients, I found this code, and converted to Qbasic...fifteen minutes.
Then last year my niece was asking about numbers, and how big do they become.
Being the good uncle, I converted it again...thirty minutes.
http://www.vbforums.com/showthread.php?t=443956
I had some problems with the Data statements.
Enjoy
Oh, I call foul. Digits to the right of zero (& the decimal point) need to be converted to English too!
I like your approach to the problem, though.
Last edited by rjbudz; Feb 17th, 2007 at 11:28 PM.
I'm not belittling anyone else's approach, in fact I used it as basis in the interest of providing other members with an updated approach.
As to the decimals, I still believe its case to case... it could be units based such as cents, microns, nanoseconds, etc. The module can be updated to handle such special cases, just create an appropriate procedure and call it. Such as accepting strDecimal as an argument then converting it to microns (up to implementor if the new decimals from shift to microns will be dropped).
EDIT: I updated the source for converting numbers to their word (or english or spelled) equivalents. Made it leaner and it now uses just three procedures. There is also the option to suppress prompting the user if errors were encountered.
Attached is the update. Feel free to debug and/or comment.
EDIT 2008-08-29: Previous update accidentally shifted to Trim instead of LTrim in removing leading zeroes. Code updated. Thanks Keithuk for heads up![]()
Last edited by leinad31; Aug 29th, 2008 at 08:10 AM.
hi i am lokking for a word converter as same like this but i need the decimal also.ex12.5 twelve point five
or26.25 =twentysix point two five so can u help me?
Depends on the wording..if you'll use hundreths, etc or just plain word version of digits.
Scan for the "." first, then pass the second set of numbers
Last edited by Eliminator2009; Jul 27th, 2010 at 06:11 AM.
I belive in pray. I pray for you.
You may have happy, healthy, wealthy life.
hope this will help you.. for Convert Number to Word (Indian Format)... Full source code Num2Word.zip Here.. You can modify it with what you need.. The Code also cover the Indian Number format issue.. ie. 12,34,563 instead of 123,456,123.
I have not coded VB in years, and I only converted this code from an , Alpha Micro 68000 system, Alpha Basic, years before.
Sorry
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
I didn't write this function, but I did fix some bugs and greatly expand the highest number possible (as well as change data types to handle it, among other things). It currently handles numbers up to 606 digits long (1 duocenuntillion - 1), after that it returns a number in terms of the largest unit in its array. Also I did this over a decade ago when I was a teenager. So go easy on me, I know it needs updating, but I rarely use it and it works as-is.
Code:Public Function ConvertNumberToText(ByVal aNumber As String) As String On Error Resume Next 'handles numbers natively from zero all the way through (1 duocenuntillion - 1) 'larger numbers are accepted, but are named in the highest available unit If (aNumber$ = "0") Or (aNumber = "-0") Then ConvertNumberToText = "Zero" Exit Function End If Dim bNeg As Boolean Dim aNames As Variant Dim iNameCounter%, aNumberName$, aTempRet$, bNeedHyphen As Boolean, iTemp%, szTemp As String, szTR As String aNumber = Replace(aNumber, ",", "") 'no commas in the input, k thx aNumber = Replace(aNumber, " ", "") 'or spaces If Left(aNumber, 1) = "-" Then aNumber = Mid$(aNumber, 2) bNeg = True End If If Len(aNumber) > 606 Then szTemp = Left(aNumber, Len(aNumber) - 603) aNumber = Right(aNumber, 603) szTR = ConvertNumberToText(szTemp) End If If Len(aNumber) > 3 Then aNames = Array("", "Thousand", "Million", "Billion", "Trillion", "Quadrillion", "Quintillion", "Sextillion", "Septillion", "Octillion", "Nonillion", _ "Decillion", "Undecillion", "Duodecillion", "Tredecillion", "Quattuordecillion", "Quindecillion", "Sexdecillion", "Septendecillion", "Octodecillion", "Novemdecillion", _ "Vigintillion", "Unvigintillion", "Duovigintillion", "Trevigintillion", "Quattuorvigintillion", "Quinvigintillion", "Sexvigintillion", "Septenvigintillion", "Octovigintillion", "Novemvigintillion", _ "Trigintillion", "Untrigintillion", "Duotrigintillion", "Tretrigintillion", "Quattuortrigintillion", "Quintrigintillion", "Sextrigintillion", "Septtrigintillion", "Octotrigintillion", "Novemtrigintillion", _ "Quadragintillion", "Unquadragintillion", "Duoquadragintillion", "Trequadragintillion", "Quattuorquadragintillion", "Quinquadragintillion", "Sexquadragintillion", "Septquadragintillion", "Octoquadragintillion", "Novemquadragintillion", _ "Quinquagintillion", "Unquinquagintillion", "Duoquinquagintillion", "Trequinquagintillion", "Quattuorquinquagintillion", "Quinquinquagintillion", "Sexquinquagintillion", "Septquinquagintillion", "Octoquinquagintillion", "Novemquinquagintillion", _ "Sexagintillion", "Unsexagintillion", "Duosexagintillion", "Tresexagintillion", "Quattuorsexagintillion", "Quinsexagintillion", "Sexsexagintillion", "Septsexagintillion", "Octosexagintillion", "Novemsexagintillion", _ "Septuagintillion", "Unseptuagintillion", "Duoseptuagintillion", "Treseptuagintillion", "Quattuorseptuagintillion", "Quinseptuagintillion", "Sexseptuagintillion", "Septseptuagintillion", "Octoseptuagintillion", "Novemseptuagintillion", _ "Octogintillion", "Unoctogintillion", "Duooctogintillion", "Treoctogintillion", "Quattuoroctogintillion", "Quinoctogintillion", "Sexoctogintillion", "Septoctogintillion", "Octooctogintillion", "Novemoctogintillion", _ "Nonagintillion", "Unnonagintillion", "Duononagintillion", "Trenonagintillion", "Quattuornonagintillion", "Quinnonagintillion", "Sexnonagintillion", "Septnonagintillion", "Octononagintillion", "Novemnonagintillion", _ "Centillion", "Cenuntillion", "Cenduotillion", "Centretillion", "Cenquattuortillion", "Cenquintillion", "Censextillion", "Censeptentillion", "Cenoctotillion", "Cennovemtillion", _ "Cendecillion", "Cenundecillion", "Cenduodecillion", "Centredecillion", "Cenquattuordecillion", "Cenquindecillion", "Censexdecillion", "Censeptendecillion", "Cenoctodecillion", "Cennovemdecillion", _ "Cenvigintillion", "Cenunvigintillion", "Cenduovigintillion", "Centrevigintillion", "Cenquattuorvigintillion", "Cenquinvigintillion", "Censexvigintillion", "Censeptenvigintillion", "Cenoctovigintillion", "Cennovemvigintillion", _ "Centrigintillion", "Cenuntrigintillion", "Cenduotrigintillion", "Centretrigintillion", "Cenquattuortrigintillion", "Cenquintrigintillion", "Censextrigintillion", "Censeptentrigintillion", "Cenoctotrigintillion", "Cennovemtrigintillion", _ "Cenquadragintillion", "Cenunquadragintillion", "Cenduoquadragintillion", "Centrequadragintillion", "Cenquattuorquadragintillion", "Cenquinquadragintillion", "Censexquadragintillion", "Censeptenquadragintillion", "Cenoctoquadragintillion", "Cennovemquadragintillion", _ "Cenquinquagintillion", "Cenunquinquagintillion", "Cenduoquinquagintillion", "Centrequinquagintillion", "Cenquattuorquinquagintillion", "Cenquinquinquagintillion", "Censexquinquagintillion", "Censeptenquinquagintillion", "Cenoctoquinquagintillion", "Cennovemquinquagintillion", _ "Censexagintillion", "Cenunsexagintillion", "Cenduosexagintillion", "Centresexagintillion", "Cenquattuorsexagintillion", "Cenquinsexagintillion", "Censexsexagintillion", "Censeptensexagintillion", "Cenoctosexagintillion", "Cennovemsexagintillion", _ "Censeptuagintillion", "Cenunseptuagintillion", "Cenduoseptuagintillion", "Centreseptuagintillion", "Cenquattuorseptuagintillion", "Cenquinseptuagintillion", "Censexseptuagintillion", "Censeptenseptuagintillion", "Cenoctoseptuagintillion", "Cennovemseptuagintillion", _ "Cenoctogintillion", "Cenunoctogintillion", "Cenduooctogintillion", "Centreoctogintillion", "Cenquattuoroctogintillion", "Cenquinoctogintillion", "Censexoctogintillion", "Censeptenoctogintillion", "Cenoctooctogintillion", "Cennovemoctogintillion", _ "Cennonagintillion", "Cenunnonagintillion", "Cenduononagintillion", "Centrenonagintillion", "Cenquattuornonagintillion", "Cenquinnonagintillion", "Censexnonagintillion", "Censeptennonagintillion", "Cenoctononagintillion", "Cennovemnonagintillion", _ "Duocentillion") 'The question is how high we should really go... aNumber = String$(3 - Len(aNumber) Mod 3, "0") & aNumber Do aTempRet = ConvertNumberToText(Right$(aNumber, 3)) If Len(aTempRet) > 0 Then If iNameCounter > 0 Then aNumberName = aTempRet & " " & aNames(iNameCounter) & ", " & aNumberName Else aNumberName = aTempRet End If End If aNumber = Left$(aNumber, Len(aNumber) - 3) iNameCounter = iNameCounter + 1 Loop Until Len(aNumber) = 0 Else aNumber = Trim$(Val(aNumber)) If Len(aNumber) = 3 Then aNumberName = Choose(Val(Left$(aNumber, 1)), "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine") & " Hundred " aNumber = Trim$(Val(Right$(aNumber, 2))) End If If Len(aNumber) = 2 Then iTemp = Val(Left$(aNumber, 1)) If iTemp > 1 Then aNumberName = aNumberName & Choose(iTemp, "", "Twenty", "Thrirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninty") aNumber = Trim$(Val(Right$(aNumber, 1))) bNeedHyphen = True Else aNumberName = aNumberName & Choose(Val(Right$(aNumber, 1)) + 1, "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen") aNumber = "" End If End If If Len(aNumber) = 1 Then iTemp = Val(Left$(aNumber, 1)) If iTemp > 0 Then If bNeedHyphen Then aNumberName = aNumberName & "-" aNumberName = aNumberName & Choose(iTemp, "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine") End If End If End If If szTR <> "" Then 'szTR = Left(szTR, Len(szTR) - 1) 'trim last comma aNumberName = szTR & " Duocentillion, " & aNumberName End If szTR = RTrim$(aNumberName) If Right(szTR, 1) = "," Then szTR = Left(szTR, Len(szTR) - 1) End If If bNeg Then szTR = "Negative " & szTR ConvertNumberToText = szTR End Function
ALSO...
There is an algorithm to name ANY number (>10^3000003; millia is the highest prefix, so it gets to milliamillia...), but it's fairly complex, and the only example I've ever found was written in CGI. It would take far longer than I'm able to spend for me to figure out how to do it in VB, but if someone else was interested, here's what I'm referring to: http://www.isthe.com/chongo/tech/mat...r/howhigh.html for the explanations; and the source of the script: http://www.isthe.com/chongo/tech/math/number/number (working version is on the site).
If anyone ever converts that algorithm to VB, please PM me!