Function CurConvert(C As Currency) As String Dim S As String Dim D As Double Dim StrLen As Integer Dim Parts() As String Dim X As Byte 'auxiliaire D = CDbl(C) 'Conversion de la variable currency en Double S = Str((Fix(D))) 'Partie entière du nombre convertie en string '**Répartition de la chaîne en petites chaînes de 3 car.***** StrLen = Len(S) If (StrLen - 1) Mod 3 = 0 Then X = ((StrLen - 1) \ 3) Else X = ((StrLen - 1) \ 3) + 1 ReDim Parts(1 To 3, X) 'redimensionnement de la matrice Dim i, j, k, Pos As Integer 'Compteurs For i = 1 To X j = 4 Do j = j - 1 Pos = StrLen - (3 * (i - 1) + j) + 1 'position de lecture If Pos < 2 Then Parts(3 - j + 1, i) = "0" Else Parts(3 - j + 1, i) = Mid(S, Pos, 1) End If 'MsgBox Parts(3 - j + 1, i) Loop Until j = 1 Next i '************************Début Traitement********************** Dim IntExp As String Dim InWhole, Whole As String Whole = "" For i = 1 To X j = 0 InWhole = "" Do j = j + 1 IntExp = "" 'Initialisation If j = 1 Then 'Traitement des centaines Select Case Parts(j, i) Case "1": IntExp = "Cent" Case "2": IntExp = "Deux cents" Case "3": IntExp = "Trois cents" Case "4": IntExp = "Quatre cents" Case "5": IntExp = "Cinq cents" Case "6": IntExp = "Six cents" Case "7": IntExp = "Sept cents" Case "8": IntExp = "Huit cents" Case "9": IntExp = "Neuf cents" End Select ElseIf j = 2 Then 'Traitement des dixaines Select Case Parts(j, i) Case "1": 'j = j + 1 Select Case Parts(3, i) Case "1": IntExp = "Onze" Case "2": IntExp = "Douze" Case "3": IntExp = "Treize" Case "4": IntExp = "Quatorze" Case "5": IntExp = "Quinze" Case "6": IntExp = "Seize" Case "7": IntExp = "Dix-sept" Case "8": IntExp = "Dix-huit" Case "9": IntExp = "Dix-neuf" Case "0": IntExp = "Dix" End Select Case "2": IntExp = "vingt" If Parts(3, i) = "1" Then IntExp = IntExp & " " & "et" Case "3": IntExp = "Trente " If Parts(3, i) = "1" Then IntExp = IntExp & " " & "et" Case "4": IntExp = "Quarante" If Parts(3, i) = "1" Then IntExp = IntExp & " " & "et" Case "5": IntExp = "Cinquante" If Parts(3, i) = "1" Then IntExp = IntExp & " " & "et" Case "6": IntExp = "Soixante" If Parts(3, i) = "1" Then IntExp = IntExp & " " & "et" Case "7": Select Case Parts(3, i) Case "1": IntExp = " et Onze" Case "2": IntExp = "Douze" Case "3": IntExp = "Treize" Case "4": IntExp = "Quatorze" Case "5": IntExp = "Quinze" Case "6": IntExp = "Seize" Case "7": IntExp = "Dix-sept" Case "8": IntExp = "Dix-huit" Case "9": IntExp = "Dix-neuf" Case "0": IntExp = "Dix" End Select IntExp = "Soixante" & " " & IntExp 'j = j + 1 Case "8": IntExp = "Quatre-vingt" If Parts(3, i) = "1" Then IntExp = IntExp & " et" Case "9": Select Case Parts(3, i) Case "1": IntExp = " et Onze" Case "2": IntExp = "Douze" Case "3": IntExp = "Treize" Case "4": IntExp = "Quatorze" Case "5": IntExp = "Quinze" Case "6": IntExp = "Seize" Case "7": IntExp = "Dix-sept" Case "8": IntExp = "Dix-huit" Case "9": IntExp = "Dix-neuf" Case "0": IntExp = "Dix" End Select IntExp = "Quatre-vingt" & " " & IntExp 'j = j + 1 End Select ElseIf j = 3 Then 'Traitement des unités If Parts(j, i) = "1" And Parts(1, i) = "0" And Parts(2, i) = "0" And i > 1 Then Select Case i Case 2: IntExp = "Mille" Case 3: IntExp = "Un Million" Case 4: IntExp = "Un Milliard" End Select Else If Parts(2, i) <> "7" And Parts(2, i) <> "9" And Parts(2, i) <> "1" Then Select Case Parts(j, i) Case "1": IntExp = "Un" Case "2": IntExp = "Deux" Case "3": IntExp = "Trois" Case "4": IntExp = "Quatre" Case "5": IntExp = "Cinq" Case "6": IntExp = "Six" Case "7": IntExp = "Sept" Case "8": IntExp = "Huit" Case "9": IntExp = "Neuf" End Select End If If Parts(2, i) <> "0" Or Parts(1, i) <> 0 Or Parts(3, i) <> 0 Then Select Case i Case 2: IntExp = IntExp & " Milles" Case 3: IntExp = IntExp & " Millions" Case 4: IntExp = IntExp & " Milliards" End Select End If End If End If If IntExp <> "" Then InWhole = InWhole + IntExp + " " Loop Until j = 3 Whole = InWhole & Whole Next i If Whole = "" Then Whole = "Zero" CurConvert = Whole 'Retour de la fonction End Function