'***********
' Devise=0 aucune
' =1 Euro €
' =2 Dollar $
' =3 franc Pacifique
' Langue=0 Français
' =1 Belgique
' =2 Suisse
'***********
' Conversion limitée à 999 999 999 999 999 ou 9 999 999 999 999,99
' si le nombre contient plus de 2 décimales, il est arrondit à 2 décimales
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 = " Euro"
If byDec > 0 Then strCentimes = strCentimes & " Cents"
Case 2
strDev = " Dollar"
If byDec > 0 Then strCentimes = strCentimes & " Cent"
Case 3
strDev = " Franc"
If byDec > 0 Then strCentimes = strCentimes & " Cent"
End Select
If dblEnt > 1 And Devise <> 0 Then strDev = strDev & "s"
ConvNumberLetter = ConvNumEnt(CDbl(dblEnt), Langue) & strDev & " " & _
ConvNumDizaine(byDec, Langue) & strCentimes
' If ConvNumEnt(CDbl(dblEnt), Langue) = "un" Then ConvNumberLetter = ConvNumEnt(CDbl(dblEnt), Langue) & _
' " franc Pacifique" & ConvNumDizaine(byDec, Langue) & strCentimes
End Function