473,416 Members | 1,548 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,416 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 4951

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..
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.