hi
I did before exactly what you request but it is not completed
a function to convert a salary digits to string
it will works with 5 digits number ( some bugs are there check it out
Public Function ConvertNumber(NumToConvert As String) As String
Dim S(1 To 5) As String
Dim digit As Long
Dim final As String
If lang = 0 Then
g1 = 1
For q = Len(NumToConvert) To 1 Step -1
g = Mid(NumToConvert, q, 1)
Select Case g1
Case 2
If g <> 0 Then
If g = 1 Then
S(g1) = "ten"
ElseIf g = 2 Then
S(g1) = "twenty"
ElseIf g = 3 Then
S(g1) = "thirty"
ElseIf g = 4 Then
S(g1) = "fourty"
ElseIf g = 5 Then
S(g1) = "fifty"
ElseIf g = 6 Then
S(g1) = "sixty"
ElseIf g = 7 Then
S(g1) = "seventy"
ElseIf g = 8 Then
S(g1) = "eighty"
ElseIf g = 9 Then
S(g1) = "ninty"
End If
Else
S(g1) = ""
End If
Case 3
If g <> 0 Then
If g = 1 Then
S(g1) = "one hundred"
ElseIf g = 2 Then
S(g1) = "tow hundreds"
ElseIf g = 3 Then
S(g1) = "three hundreds"
ElseIf g = 4 Then
S(g1) = "four hundreds"
ElseIf g = 5 Then
S(g1) = "five hundreds"
ElseIf g = 6 Then
S(g1) = "six hundreds"
ElseIf g = 7 Then
S(g1) = "seven hundreds"
ElseIf g = 8 Then
S(g1) = "eight hundreds"
ElseIf g = 9 Then
S(g1) = "nine hundreds"
End If
Else
S(g1) = ""
End If
Case 4
If NumToConvert > 999 And NumToConvert < 10000 Then
If g <> 0 Then
If g = 1 Then
S(g1) = "one thousand"
ElseIf g = 2 Then
S(g1) = "two thousands"
ElseIf g = 3 Then
S(g1) = "three thousands"
ElseIf g = 4 Then
S(g1) = "four thousands"
ElseIf g = 5 Then
S(g1) = "five thousands"
ElseIf g = 6 Then
S(g1) = "six thousands"
ElseIf g = 7 Then
S(g1) = "seven thousands"
ElseIf g = 8 Then
S(g1) = "eight thousands"
ElseIf g = 9 Then
S(g1) = "nine thousands"
End If
Else
g(g1) = ""
End If
ElseIf NumToConvert > 9999 And NumToConvert < 100000 Then
If g <> 0 Then
If g = 1 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "eleven"
Else
S(g1) = "one"
End If
ElseIf g = 2 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "twelve"
Else
S(g1) = "two"
End If
ElseIf g = 3 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "thirteen"
Else
S(g1) = "three"
End If
ElseIf g = 4 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "fourteen"
Else
S(g1) = "four"
End If
ElseIf g = 5 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "fifteen"
Else
S(g1) = "five"
End If
ElseIf g = 6 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "sixteen"
Else
S(g1) = "six"
End If
ElseIf g = 7 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "seventeen"
Else
S(g1) = "seven"
End If
ElseIf g = 8 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "eighteen"
Else
S(g1) = "eight"
End If
ElseIf g = 9 Then
If Mid(NumToConvert, 1, 1) = 1 Then
S(g1) = "ninteen"
Else
S(g1) = "nine"
End If
End If
Else
S(g1) = ""
End If
End If
Case 5
If g <> 0 Then
If g = 1 Then
S(g1) = "ten"
ElseIf g = 2 Then
S(g1) = "twenty"
ElseIf g = 3 Then
S(g1) = "thirty"
ElseIf g = 4 Then
S(g1) = "fourty"
ElseIf g = 5 Then
S(g1) = "fifty"
ElseIf g = 6 Then
S(g1) = "sixty"
ElseIf g = 7 Then
S(g1) = "seventy"
ElseIf g = 8 Then
S(g1) = "eighty"
ElseIf g = 9 Then
S(g1) = "ninty"
End If
Else
S(g1) = ""
End If
End Select
g1 = g1 + 1
Next
If Val(NumToConvert) > 9999 Then
If Mid(NumToConvert, 1, 1) = 1 And Mid(NumToConvert, 2, 1) <> "0" Then
S(Len(NumToConvert)) = ""
End If
End If
If Val(NumToConvert) > 9999 Then
S(4) = S(5) & " " & ANDRELATION & S(4) & " thousands"
End If
For Y = 4 To 2 Step -1
If final <> "" Then
If S(Y) <> "" And anddone = 1 Then
final = " " & final & " and " & S(Y)
anddone = 1
ElseIf S(Y) <> "" Then
final = " " & final & " " & S(Y)
anddone = 1
End If
Else
final = S(Y)
End If
Next
ConvertNumber = final
End If
End Function
hope I did help