473,289 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,289 developers and data experts.

Convert Amount in to Words

Dim vNumber As Double


Function NumberToWords(ByVal vNumber As Long, Optional BlankIfZero As Boolean) As String


Select Case Number

Case 0

NumberToWords = IIf(BlankIfZero, "", "Zero")


Case 1 To 19

NumberToWords = Choose(vNumber, "One ", "Two ", "Three ", "Four ", _
"Five ", "Six ", "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ", _
"Twelve ", "Thirteen ", "Fourteen ", "Fifteen ", "Sixteen ", _
"Seventeen ", "Eighteen ", "Nineteen ")

Case 20 To 99

NumberToWords = Choose(vNumber \ 10 - 1, "Twenty ", "Thirty ", _
"Fourty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", _
"Ninety ") & NumberToWords(vNumber Mod 10, True)

Case 100 To 999

NumberToWords = NumberToWords(vNumber \ 100) & "Hundred " & IIf _
(Number >= 200, "", "") & NumberToWords(Number Mod 100, True)

Case 1000 To 99999

NumberToWords = NumberToWords(vNumber \ 1000) & "Thousand " & IIf _
(Number >= 2000, " ", "") & NumberToWords(vNumber Mod 1000, True)

Case 100000 To 9999999

NumberToWords = NumberToWords(vNumber \ 100000) & "Lakh " & IIf _
(Number >= 200000, " ", "") & NumberToWords(vNumber Mod 100000, True)


Case 10000000 To 999999999

NumberToWords = NumberToWords(vNumber \ 10000000) & "Crore " & IIf _
(Number >= 20000000, " ", "") & NumberToWords(vNumber Mod 10000000, _
True)

End Select



End Function


v_A2w = UCase(NumberToWords(RS("Inv_Payamt") ) & "Rupees Only.")
Feb 19 '22 #1
0 4937

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Nico Grubert | last post by:
Hi there, Background of this question is: I want to convert all words <word> except 'and' / 'or' / 'and not' from a string into '*<word>*'. Example: I have the following string: "test and...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
0
by: ZSP747 | last post by:
Now,I prepare to write a English-Chinese dictionary.So I want find a function or library can convert the words from one form to another,such as "boys"->"boy","became->become","went"->"go"....
5
by: ZSP747 | last post by:
Now,I prepare to write a English-Chinese dictionary. So I want find a function or library can convert the words from one form to another,such as "boys"->"boy","became->become","went"->"go"....
2
by: martin77 | last post by:
Here is what I have for the code keep getting error on 'declare variables and assign address to object variables Dim strId As String, strPayment As String, curPayment As Currency ...
1
by: magz123 | last post by:
guyz.. Is there any function in vb6 to convert amount in digits to amount in words...like e.g from Rs.450 to four hundred and fifty ... if anyone knows reply to it as soon as possible..
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.