1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Sub Test()
Dim tablo() As Byte
Dim dep As Long
mesure = Array("", "", " cent ", " mille ", "", " cent ", " million ", "", " cent ", "", "", " cent ", "", "", " cent ", "", "", " cent ", "", "", " cent ", "", "", " cent ", "", "", "", "", "", "", "", "", "")
unit1 = Array("", " Un", " Deux", " Trois", " Quatre", " Cinq", " Six", " Sept", " Huit", " Neuf", " Dix", " Onze", " Douze", " Treize", " Quatorze", " Quinze", " Seize", " Dix Sept", " Dix Huit", " Dix Neuf")
unit10 = Array("", " dix ", " vingt ", " trente ", " quarante ", " cinquante ", " soixante ", " soixante dix ", " quatre-vingt ", " quatre-vingt dix ")
nombre = 473856354811497#
tablo = StrConv(nombre, vbFromUnicode)
ReDim tablf(UBound(tablo))
For I = 0 To UBound(tablo) - 1
Index = Chr(tablo(UBound(tablo) - I))
Index_1 = Chr(tablo(UBound(tablo) - (I + 1)))
Select Case I
Case 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30
tablf(UBound(tablf) - I) = unit1(Index)
If Index_1 = 1 Or Index_1 = 7 Or Index_1 = 9 And Index > 0 Then tablf(UBound(tablf) - I) = unit1(Index + 10) & mesure(I): pas = 1:
Case 2, 5, 8, 11, 14, 17, 20, 23, 26, 29
tablf(UBound(tablf) - I) = unit1(Index - pas) & mesure(I)
Case 1, 4, 7, 10, 13, 16, 19, 22, 25, 28
tablf(UBound(tablf) - I) = unit10(Index - pas) & mesure(I)
pas = 0
End Select
tablf(0) = unit1(Chr(tablo(0)))
Next
Debug.Print Join(tablf, "|")
End Sub |
Partager