Bonjour,
Essayez ceci:
Public Function ConvNumberLetter(Nombre As Double, Optional Devise As Byte = 0, Optional Langue As Byte = 0) As String
Dim dblEnt As Variant, byDec As Byte
Dim bNegatif As Boolean
Dim strDev As String, strCentimes As String
If Nombre < 0 Then
bNegatif = True
Nombre = Abs(Nombre)
End If
dblEnt = Int(Nombre)
byDec = CInt((Nombre - dblEnt) * 100)
If byDec = 0 Then
If dblEnt > 999999999999999# Then
ConvNumberLetter = "#TropGrand"
Exit Function
End If
Else
If dblEnt > 9999999999999.99 Then
ConvNumberLetter = "#TropGrand"
Exit Function
End If
End If
Select Case Devise
Case 0
If byDec > 0 Then strDev = " virgule"
Case 1
strDev = " Euros"
If byDec > 0 Then strCentimes = strCentimes & " Centimes"
Case 2
strDev = " Dollars"
If byDec > 0 Then strCentimes = strCentimes & " Cent"
Case 3
strDev = " FCFA"
If byDec > 0 Then strCentimes = strCentimes & " Centimes"
Case 4
strDev = " GNF"
If byDec > 0 Then strCentimes = strCentimes & " Centimes"
Case 5
strDev = " KES"
If byDec > 0 Then strCentimes = strCentimes & " Cents"
Case 6
strDev = " Ariarys"
If byDec > 0 Then strCentimes = strCentimes & " Centimes"
Case 7
strDev = " Dirhams"
If byDec > 0 Then strCentimes = strCentimes & " Centimes"
End Select
If dblEnt = 0 And byDec <> 0 Then
ConvNumberLetter = Langue & strDev & " " & ConvNumDizaine(byDec, Langue) & strCentimes
Else
If dblEnt > 0 Then
ConvNumberLetter = ConvNumEnt(CDbl(dblEnt), Langue) & strDev & " " & ConvNumDizaine(byDec, Langue) & strCentimes
End If
End If
End Function
Cdlt