by Ajay Mishra (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 22nd May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Coverting Indian currency amount in number to Amount in word up to Rs.99999999.99
API Declarations
32026991.67 will be converted to Three Crore Twenty Lakhs twenty six thousand Nine hundred Ninety One only.
Dim U(90)
Dim Mstring, Mpais, Mchunk1 As String
Dim thou, hun, ten, one, dig, hun1, one1, hun2, one2, mt, p1, p2 As String
Dim T, T1, T2 As Long
Dim P As Integer
U(0) = "ZERO"
U(1) = "ONE"
U(2) = "TWO"
U(3) = "THREE"
U(4) = "FOUR"
U(5) = "FIVE"
U(6) = "SIX"
U(7) = "SEVEN"
U(8) = "EIGHT"
U(9) = "NINE"
U(10) = "TEN"
U(11) = "ELEVEN"
U(12) = "TWLEVE"
U(13) = "THIRTEEN"
U(14) = "FOURTEEN"
U(15) = "FIFTEEN"
U(16) = "SIXTEEN"
U(17) = "SEVENTEEN"
U(18) = "EIGHTEEN"
U(19) = "NINETEEN"
U(20) = "TWENTY"
U(30) = "THIRTY"
U(40) = "FORTY"
U(50) = "FIFTY"
U(60) = "SIXTY"
U(70) = "SEVENTY"
U(80) = "EIGHTY"
U(90) = "NINETY"
English = " "
Mstring = Format(mamount, "#########0.00")
If Len(Mstring) < 11 Then
Mstring = Space(11 - Len(Mstring)) + Mstring
End If
Mpais = Right(Mstring, 2)
Mchunk1 = Mid(Mstring, 1, 5)
If Val(Mchunk1) > 0 Then
thou = Mid(Mchunk1, 1, 1)
hun1 = Mid(Mchunk1, 2, 2)
one1 = Mid(Mchunk1, 3, 1)
hun2 = Mid(Mchunk1, 4, 2)
one2 = Mid(Mchunk1, 5, 1)
If Val(thou) > 0 Then
mt = U(Val(thou))
English = English & mt & " CRORE "
End If
If Val(hun1) > 0 Then
T1 = Val(hun1)
If T1 > 0 Then
If (Int(T1 / 10#) = T1 / 10#) Or (T1 > 9 And T1 < 20) Then
English = English + U(Val(hun1))
Else
If T1 > 9 And (Int(T1 / 10#) <> T1 / 10#) Then
hun1 = Mid(hun1, 1, 1) + "0"
English = English + U(Val(hun1)) + " " + U(Val(one1))
Else
If T1 < 10 Then
English = English + U(Val(one1))
End If
End If
End If
English = English + " LAKH "
End If
End If
If Val(hun2) > 0 Then
T2 = Val(hun2)
If T2 > 0 Then
If (Int(T2 / 10#) = T2 / 10#) Or (T2 > 9 And T2 < 20) Then
English = English + U(Val(hun2))
Else
If T2 > 9 And (Int(T2 / 10#) <> T2 / 10#) Then
hun2 = Mid(hun2, 1, 1) + "0"
English = English + U(Val(hun2)) + " " + U(Val(one2))
Else
If T2 < 10 Then
English = English + U(Val(one2))
End If
End If
End If
English = English + " THOUSAND "
End If
End If
End If
Mchunk1 = Mid(Mstring, 6, 3)
hun = Mid(Mchunk1, 1, 1)
ten = Mid(Mchunk1, 2, 2)
one = Mid(Mchunk1, 3, 1)
If Val(Mchunk1) > 99 Then
English = English + U(Val(hun)) + " HUNDRED "
End If
T = Val(ten)
If T > 0 Then
If (Int(T / 10#) = T / 10#) Or (T > 9 And T < 20) Then
English = English + U(Val(ten))
Else
If T > 9 And (Int(T / 10#) <> T / 10#) Then
ten = Mid(ten, 1, 1) + "0"
English = English + U(Val(ten)) + " " + U(Val(one))
Else
If T < 10 Then
English = English + U(Val(one))
End If
End If
End If
End If
p1 = Mid(Mpais, 1, 1)
p2 = Mid(Mpais, 2, 1)
P = Val(Mpais)
dig = " "
If P > 0 Then
If (Int(P / 10#) = P / 10#) Or (P > 9 And P < 20) Then
p1 = Mid(Mpais, 1, 2)
dig = dig + U(Val(p1))
Else
If P > 9 And (Int(P / 10#) <> P / 10#) Then
p1 = Mid(Mpais, 1, 1) + "0"
dig = dig + U(Val(p1)) + " " + U(Val(p2))
Else
If P < 10 Then
dig = dig + U(Val(p2))
End If
End If
End If
AmountinWord = Trim(English + " PAISE " + dig + " ONLY.")
Else
AmountinWord = Trim(English + " ONLY.")
End If
AmountinWord = "Rs. " + UCase(Left(AmountinWord, 1)) + LCase(Mid(AmountinWord, 2, Len(AmountinWord) - 1))
End Function
###############YOU CAN CALL THE ABOVE FUNCTION FROM THE BELOW procedure #####
Dim strAmount as string
strAmount = AmountinWord(4290238.88)
or
strAmount = AmountinWord(txtAmount)
No comments have been posted about Coverting Indian currency amount in number to Amount in word up to Rs.99999999.99. Why not be the first to post a comment about Coverting Indian currency amount in number to Amount in word up to Rs.99999999.99.