by Ayan Chaudhuri (8 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sat 2nd March 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Convert any amount into words... like the function will return 100 as Rupees One Hundred Only... Just place the code in any module & call
Dim Wamt As String, Paise As Variant
Paise = Int((Amount - Int(Amount)) * 100)
Wamt = "Rupees"
Amount = Int(Amount)
If Amount > 9999999 Then
cr = Int(Integer_Mine(Amount, 10000000))
ccr = Convert_Sub(cr)
Wamt = Wamt + ccr + " Crore "
Amount = Amount Mod 10000000
End If
If Amount > 99999 Then
lk = Int(Integer_Mine(Amount, 100000))
clk = Convert_Sub(lk)
Wamt = Wamt + clk + " Lakh "
Amount = Amount Mod 100000
End If
If Amount > 999 Then
th = Int(Integer_Mine(Amount, 1000))
cth = Convert_Sub(th)
Wamt = Wamt + cth + " Thousand "
Amount = Amount Mod 1000
End If
If Amount > 99 Then
H = Int(Integer_Mine(Amount, 100))
ch = Convert_Sub(H)
Wamt = Wamt + ch + " Hundred "
Amount = Amount Mod 100
End If
crest = Convert_Sub(Amount)
Wamt = Wamt + crest
wpaise = ""
If Paise > 0 Then
wpaise = Convert_Sub(Paise)
Wamt = Wamt + " And Paise" + wpaise
End If
Convert_Main = Wamt + " Only."
End Function
Public Function Convert_Sub(Amt As Variant) As String
Dim Units(9), Teens(9), Tens(9)
Dim U, T As Variant, W As String
Units(1) = "One"
Units(2) = "Two"
Units(3) = "Three"
Units(4) = "Four"
Units(5) = "Five"
Units(6) = "Six"
Units(7) = "Seven"
Units(8) = "Eight"
Units(9) = "Nine"
Teens(1) = "Eleven"
Teens(2) = "Twelve"
Teens(3) = "Thirteen"
Teens(4) = "Fourteen"
Teens(5) = "Fifteen"
Teens(6) = "Sixteen"
Teens(7) = "Seventeen"
Teens(8) = "Eighteen"
Teens(9) = "Nineteen"
Tens(1) = "Ten"
Tens(2) = "Twenty"
Tens(3) = "Thirty"
Tens(4) = "Fourty"
Tens(5) = "Fifty"
Tens(6) = "Sixty"
Tens(7) = "Seventy"
Tens(8) = "Eighty"
Tens(9) = "Ninety"
U = Amt Mod 10
T = Integer_Mine(Amt, 10)
W = ""
If T > 1 Then
W = " " + Tens(T)
If U > 0 Then
W = W + " " + Units(U)
End If
End If
If T = 1 And U = 0 Then
W = " " + Tens(T)
End If
If T = 1 And U > 0 Then
W = " " + Teens(U)
End If
If T = 0 And U > 0 Then
W = W + " " + Units(U)
End If
Convert_Sub = W
End Function
Public Function Integer_Mine(No As Variant, Divider As Variant) As Variant
Integer_Mine = Int(No / Divider)
End Function
No comments have been posted about Convert any amount into words... like the function will return 100 as Rupees One Hundred Only... Ju. Why not be the first to post a comment about Convert any amount into words... like the function will return 100 as Rupees One Hundred Only... Ju.