1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| Option Explicit
Sub TestEquivalentArrayList()
Dim Tableau As Dictionary
Set Tableau = New Dictionary
Tableau.Add "k1", "f" 'ajout de clé / valeur
Tableau.Add "k2", "ff" 'ajout de clé / valeur
Tableau.Add "k3", "fff" 'ajout de clé / valeur
Call AllerVersFonction(Tableau)
Debug.Print Tableau("k3") 'equivalent indexof
End Sub
Function AllerVersFonction(t As Dictionary) As String
Dim i As Integer
For i = 0 To t.Count - 1
Debug.Print t.Keys(i) 'accès aux clés par indice
Debug.Print t.Items(i) 'accès aux valeurs par indice
Next i
AllerVersFonction = t(1)
End Function |
Partager