Most system that involve payment required the converted word it's numerical value but the problem is, Visual Basic 6 don't have any built in function to this. Because of this we created a function that convert number to word. This function can convert up to 9 hundred thousands since we don't need to convert values higher than this. Adding more than 9 hundred thousands is easy, if you want to implement this to your system just copy the code below.
Public Function NumberToWord(Number As Double) As String
Dim hundred_hundred_thousand As String
Dim hundred_ten_one As String
hundred_hundred_thousand = ""
hundred_ten_one = ""
If Number >= 900000 Then
hundred_thousand = hundred_thousand & "NINE HUNDRED "
Number = Format(Number - 900000, "0.00")
ElseIf Number >= 800000 Then
hundred_thousand = hundred_thousand & "EIGHT HUNDRED "
Number = Format(Number - 800000, "0.00")
ElseIf Number >= 700000 Then
hundred_thousand = hundred_thousand & "SEVEN HUNDRED "
Number = Format(Number - 700000, "0.00")
ElseIf Number >= 600000 Then
hundred_thousand = hundred_thousand & "SIX HUNDRED "
Number = Format(Number - 600000, "0.00")
ElseIf Number >= 500000 Then
hundred_thousand = hundred_thousand & "FIVE HUNDRED "
Number = Format(Number - 500000, "0.00")
ElseIf Number >= 400000 Then
hundred_thousand = hundred_thousand & "FOUR HUNDRED "
Number = Format(Number - 400000, "0.00")
ElseIf Number >= 300000 Then
hundred_thousand = hundred_thousand & "THREE HUNDRED "
Number = Format(Number - 300000, "0.00")
ElseIf Number >= 200000 Then
hundred_thousand = hundred_thousand & "TWO HUNDRED "
Number = Format(Number - 200000, "0.00")
ElseIf Number >= 100000 Then
hundred_thousand = hundred_thousand & "ONE HUNDRED "
Number = Format(Number - 100000, "0.00")
End If
If Number >= 90000 Then
hundred_thousand = hundred_thousand & "NINETY "
Number = Format(Number - 90000, "0.00")
ElseIf Number >= 80000 Then
hundred_thousand = hundred_thousand & "EIGHTY "
Number = Format(Number - 80000, "0.00")
ElseIf Number >= 70000 Then
hundred_thousand = hundred_thousand & "SEVENTY "
Number = Format(Number - 70000, "0.00")
ElseIf Number >= 60000 Then
hundred_thousand = hundred_thousand & "SIXTY "
Number = Format(Number - 60000, "0.00")
ElseIf Number >= 50000 Then
hundred_thousand = hundred_thousand & "FIFTY "
Number = Format(Number - 50000, "0.00")
ElseIf Number >= 40000 Then
hundred_thousand = hundred_thousand & "FORTY "
Number = Format(Number - 40000, "0.00")
ElseIf Number >= 30000 Then
hundred_thousand = hundred_thousand & "THIRTY "
Number = Format(Number - 30000, "0.00")
ElseIf Number >= 20000 Then
hundred_thousand = hundred_thousand & "TWENTY "
Number = Format(Number - 20000, "0.00")
End If
If Number >= 19000 Then
hundred_thousand = hundred_thousand & "NINETEEN "
Number = Format(Number - 19000, "0.00")
ElseIf Number >= 18000 Then
hundred_thousand = hundred_thousand & "EIGHTEEN "
Number = Format(Number - 18000, "0.00")
ElseIf Number >= 17000 Then
hundred_thousand = hundred_thousand & "SEVENTEEN "
Number = Format(Number - 17000, "0.00")
ElseIf Number >= 16000 Then
hundred_thousand = hundred_thousand & "SIXTEEN "
Number = Format(Number - 16000, "0.00")
ElseIf Number >= 15000 Then
hundred_thousand = hundred_thousand & "FIFTEEN "
Number = Format(Number - 15000, "0.00")
ElseIf Number >= 14000 Then
hundred_thousand = hundred_thousand & "FOURTEEN "
Number = Format(Number - 14000, "0.00")
ElseIf Number >= 13000 Then
hundred_thousand = hundred_thousand & "THIRTEEN "
Number = Format(Number - 13000, "0.00")
ElseIf Number >= 12000 Then
hundred_thousand = hundred_thousand & "TWELVE "
Number = Format(Number - 12000, "0.00")
ElseIf Number >= 11000 Then
hundred_thousand = hundred_thousand & "ELEVEN "
Number = Format(Number - 11000, "0.00")
ElseIf Number >= 10000 Then
hundred_thousand = hundred_thousand & "TEN "
Number = Format(Number - 10000, "0.00")
ElseIf Number >= 9000 Then
hundred_thousand = hundred_thousand & "NINE "
Number = Format(Number - 9000, "0.00")
ElseIf Number >= 8000 Then
hundred_thousand = hundred_thousand & "EIGHT "
Number = Format(Number - 8000, "0.00")
ElseIf Number >= 7000 Then
hundred_thousand = hundred_thousand & "SEVEN "
Number = Format(Number - 7000, "0.00")
ElseIf Number >= 6000 Then
hundred_thousand = hundred_thousand & "SIX "
Number = Format(Number - 6000, "0.00")
ElseIf Number >= 5000 Then
hundred_thousand = hundred_thousand & "FIVE "
Number = Format(Number - 5000, "0.00")
ElseIf Number >= 4000 Then
hundred_thousand = hundred_thousand & "FOUR "
Number = Format(Number - 4000, "0.00")
ElseIf Number >= 3000 Then
hundred_thousand = hundred_thousand & "THREE "
Number = Format(Number - 3000, "0.00")
ElseIf Number >= 2000 Then
hundred_thousand = hundred_thousand & "TWO "
Number = Format(Number - 2000, "0.00")
ElseIf Number >= 1000 Then
hundred_thousand = hundred_thousand & "ONE "
Number = Format(Number - 1000, "0.00")
End If
If Trim(hundred_thousand) <> "" Then
hundred_thousand = hundred_thousand & "THOUSAND"
End If
If Number >= 900 Then
hundred_ten_one = "NINE HUNDRED"
Number = Format(Number - 900, "0.00")
ElseIf Number >= 800 Then
hundred_ten_one = "EIGHT HUNDRED"
Number = Format(Number - 800, "0.00")
ElseIf Number >= 700 Then
hundred_ten_one = "SEVEN HUNDRED"
Number = Format(Number - 700, "0.00")
ElseIf Number >= 600 Then
hundred_ten_one = "SIX HUNDRED"
Number = Format(Number - 600, "0.00")
ElseIf Number >= 500 Then
hundred_ten_one = "FIVE HUNDRED"
Number = Format(Number - 500, "0.00")
ElseIf Number >= 400 Then
hundred_ten_one = "FOUR HUNDRED"
Number = Format(Number - 400, "0.00")
ElseIf Number >= 300 Then
hundred_ten_one = "THREE HUNDRED"
Number = Format(Number - 300, "0.00")
ElseIf Number >= 200 Then
hundred_ten_one = "TWO HUNDRED"
Number = Format(Number - 200, "0.00")
ElseIf Number >= 100 Then
hundred_ten_one = "ONE HUNDRED"
Number = Format(Number - 100, "0.00")
End If
If Number >= 90 Then
hundred_ten_one = hundred_ten_one + " NINETY"
Number = Format(Number - 90, "0.00")
ElseIf Number >= 80 Then
hundred_ten_one = hundred_ten_one + " EIGHTY"
Number = Format(Number - 80, "0.00")
ElseIf Number >= 70 Then
hundred_ten_one = hundred_ten_one + " SEVENTY"
Number = Format(Number - 70, "0.00")
ElseIf Number >= 60 Then
hundred_ten_one = hundred_ten_one + " SIXTY"
Number = Format(Number - 60, "0.00")
ElseIf Number >= 50 Then
hundred_ten_one = hundred_ten_one + " FIFTY"
Number = Format(Number - 50, "0.00")
ElseIf Number >= 40 Then
hundred_ten_one = hundred_ten_one + " FORTY"
Number = Format(Number - 40, "0.00")
ElseIf Number >= 30 Then
hundred_ten_one = hundred_ten_one + " THIRTY"
Number = Format(Number - 30, "0.00")
ElseIf Number >= 20 Then
hundred_ten_one = hundred_ten_one + " TWENTY"
Number = Format(Number - 20, "0.00")
End If
If Number >= 19 Then
hundred_ten_one = hundred_ten_one + " NINETEEN"
Number = Format(Number - 19, "0.00")
ElseIf Number >= 18 Then
hundred_ten_one = hundred_ten_one + " EIGHTEEN"
Number = Format(Number - 18, "0.00")
ElseIf Number >= 17 Then
hundred_ten_one = hundred_ten_one + " SEVENTEEN"
Number = Format(Number - 17, "0.00")
ElseIf Number >= 16 Then
hundred_ten_one = hundred_ten_one + " SIXTEEN"
Number = Format(Number - 16, "0.00")
ElseIf Number >= 15 Then
hundred_ten_one = hundred_ten_one + " FIFTEEN"
Number = Format(Number - 15, "0.00")
ElseIf Number >= 14 Then
hundred_ten_one = hundred_ten_one + " FOURTEEN"
Number = Format(Number - 14, "0.00")
ElseIf Number >= 13 Then
hundred_ten_one = hundred_ten_one + " THIRTEEN"
Number = Format(Number - 13, "0.00")
ElseIf Number >= 12 Then
hundred_ten_one = hundred_ten_one + " TWELVE"
Number = Format(Number - 12, "0.00")
ElseIf Number >= 11 Then
hundred_ten_one = hundred_ten_one + " ELEVEN"
Number = Format(Number - 11, "0.00")
ElseIf Number >= 10 Then
hundred_ten_one = hundred_ten_one + " TEN"
Number = Format(Number - 10, "0.00")
ElseIf Number >= 9 Then
hundred_ten_one = hundred_ten_one + " NINE"
Number = Format(Number - 9, "0.00")
ElseIf Number >= 8 Then
hundred_ten_one = hundred_ten_one + " EIGHT"
Number = Format(Number - 8, "0.00")
ElseIf Number >= 7 Then
hundred_ten_one = hundred_ten_one + " SEVEN"
Number = Format(Number - 7, "0.00")
ElseIf Number >= 6 Then
hundred_ten_one = hundred_ten_one + " SIX"
Number = Format(Number - 6, "0.00")
ElseIf Number >= 5 Then
hundred_ten_one = hundred_ten_one + " FIVE"
Number = Format(Number - 5, "0.00")
ElseIf Number >= 4 Then
hundred_ten_one = hundred_ten_one + " FOUR"
Number = Format(Number - 4, "0.00")
ElseIf Number >= 3 Then
hundred_ten_one = hundred_ten_one + " THREE"
Number = Format(Number - 3, "0.00")
ElseIf Number >= 2 Then
hundred_ten_one = hundred_ten_one + " TWO"
Number = Format(Number - 2, "0.00")
ElseIf Number >= 1 Then
hundred_ten_one = hundred_ten_one + " ONE"
Number = Format(Number - 1, "0.00")
End If
hundred_ten_one = hundred_ten_one + " PESOS"
If Val(Number) = 0 Then
NumberToWord = hundred_thousand & " " & hundred_ten_one
Exit Function
End If
hundred_ten_one = hundred_ten_one + " &"
If Number >= 0.9 Then
hundred_ten_one = hundred_ten_one + " NINETY"
Number = Format(Number - 0.9, "0.00")
ElseIf Number >= 0.8 Then
hundred_ten_one = hundred_ten_one + " EIGHTY"
Number = Format(Number - 0.8, "0.00")
ElseIf Number >= 0.7 Then
hundred_ten_one = hundred_ten_one + " SEVENTY"
Number = Format(Number - 0.7, "0.00")
ElseIf Number >= 0.6 Then
hundred_ten_one = hundred_ten_one + " SIXTY"
Number = Format(Number - 0.6, "0.00")
ElseIf Number >= 0.5 Then
hundred_ten_one = hundred_ten_one + " FIFTY"
Number = Format(Number - 0.5, "0.00")
ElseIf Number >= 0.4 Then
hundred_ten_one = hundred_ten_one + " FORTY"
Number = Format(Number - 0.4, "0.00")
ElseIf Number >= 0.3 Then
hundred_ten_one = hundred_ten_one + " THIRTY"
Number = Format(Number - 0.3, "0.00")
ElseIf Number >= 0.2 Then
hundred_ten_one = hundred_ten_one + " TWENTY"
Number = Format(Number - 0.2, "0.00")
End If
If Format(Val(Number), "0.00") >= "0.19" Then
hundred_ten_one = hundred_ten_one + " NINETEEN"
Number = Format(Number - 0.19, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.18" Then
hundred_ten_one = hundred_ten_one + " EIGHTEEN"
Number = Format(Number - 0.18, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.17" Then
hundred_ten_one = hundred_ten_one + " SEVENTEEN"
Number = Format(Number - 0.17, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.16" Then
hundred_ten_one = hundred_ten_one + " SIXTEEN"
Number = Format(Number - 0.16, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.15" Then
hundred_ten_one = hundred_ten_one + " FIFTEEN"
Number = Format(Number - 0.15, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.14" Then
hundred_ten_one = hundred_ten_one + " FOURTEEN"
Number = Format(Number - 0.14, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.13" Then
hundred_ten_one = hundred_ten_one + " THIRTEEN"
Number = Format(Number - 0.13, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.12" Then
hundred_ten_one = hundred_ten_one + " TWELVE"
Number = Format(Number - 0.12, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.11" Then
hundred_ten_one = hundred_ten_one + " ELEVEN"
Number = Format(Number - 0.11, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.10" Then
hundred_ten_one = hundred_ten_one + " TEN"
Number = Format(Number - 0.1, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.09" Then
hundred_ten_one = hundred_ten_one + " NINE"
Number = Format(Number - 0.09, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.08" Then
hundred_ten_one = hundred_ten_one + " EIGHT"
Number = Format(Number - 0.08, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.07" Then
hundred_ten_one = hundred_ten_one + " SEVEN"
Number = Format(Number - 0.07, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.06" Then
hundred_ten_one = hundred_ten_one + " SIX"
Number = Format(Number - 0.06, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.05" Then
hundred_ten_one = hundred_ten_one + " FIVE"
Number = Format(Number - 0.05, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.04" Then
hundred_ten_one = hundred_ten_one + " FOUR"
Number = Format(Number - 0.04, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.03" Then
hundred_ten_one = hundred_ten_one + " THREE"
Number = Format(Number - 0.03, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.02" Then
hundred_ten_one = hundred_ten_one + " TWO"
Number = Format(Number - 0.02, "0.00")
ElseIf Format(Val(Number), "0.00") >= "0.01" Then
hundred_ten_one = hundred_ten_one + " ONE"
Number = Format(Number - 0.01, "0.00")
End If
hundred_ten_one = hundred_ten_one + " CENTS"
NumberToWord = hundred_thousand & " " & hundred_ten_one
End Function