1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Public Sub Genere_Password()
Dim t As Variant
Dim i As Integer
Dim index As Integer
Dim Pwd As String
t = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", _
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", _
"h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", _
"y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
Pwd = "" 'Initialise la chaine
For i = 1 To 20
index = Int(62 * Rnd) ' génère un indice entre 0 et 61 pour le tableau
Pwd = Pwd & t(index) ' Ajoute le caractère à la chaine
Next i
Debug.Print Pwd
End Sub |
Partager