Function Ntow(amt As Variant) As VariantDim FIGURE As Variant
Dim LENFIG As Integer
Dim i As Integer
Dim WORDs(19) As String
Dim tens(9) As String
WORDs(1) = "એક "
WORDs(2) = "બે "
WORDs(3) = "ત્રણ "
WORDs(4) = "ચાર "
WORDs(5) = "પાંચ "
WORDs(6) = "છ "
WORDs(7) = "સાત "
WORDs(8) = "આઠ "
WORDs(9) = "નવ "
WORDs(10) = "દસ "
WORDs(11) = "અગિયાર "
WORDs(12) = "બાર "
WORDs(13) = "તેર "
WORDs(14) = "ચૌદ "
WORDs(15) = "પંદર "
WORDs(16) = "સોળ "
WORDs(17) = "સતર "
WORDs(18) = "અઢાર "
WORDs(19) = "ઓગણીસ "
tens(2) = "વીસ "
tens(3) = "ત્રીસ "
tens(4) = "ચાલીસ "
tens(5) = "પચાસ "
tens(6) = "સાઇઠ "
tens(7) = "સીંતેર "
tens(8) = "એંસી "
tens(9) = "નેવું "
FIGURE = amt
FIGURE = Format(FIGURE, "FIXED")
FIGLEN = Len(FIGURE)
If FIGLEN < 12 Then
FIGURE = Space(12 - FIGLEN) & FIGURE
End If
If Val(Left(FIGURE, 9)) > 1 Then
Ntow = "રૂા. "
ElseIf Val(Left(FIGURE, 9)) = 1 Then
Ntow = "રૂા. "
End If
For i = 1 To 3
If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If
If i = 1 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & "કરોડ "
ElseIf i = 2 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & "લાખ "
ElseIf i = 3 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & "હજાર "
End If
FIGURE = Mid(FIGURE, 3)
Next i
If Val(Left(FIGURE, 1)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 1))) + "સો "
End If
FIGURE = Mid(FIGURE, 2)
If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If
FIGURE = Mid(FIGURE, 4)
If Val(FIGURE) > 0 Then
Ntow = Ntow & "પૈસા "
If Val(Left(FIGURE, 2)) < 20 And Val(Left(FIGURE, 2)) > 0 Then
Ntow = Ntow & WORDs(Val(Left(FIGURE, 2)))
ElseIf Val(Left(FIGURE, 2)) > 19 Then
Ntow = Ntow & tens(Val(Left(FIGURE, 1)))
Ntow = Ntow & WORDs(Val(Right(Left(FIGURE, 2), 1)))
End If
End If
FIGURE = amt
FIGURE = Format(FIGURE, "FIXED")
If Val(FIGURE) > 0 Then
Ntow = Ntow & "પુરા"
End If
End Function