Créer un tableau contenant un tableau?
Bonjour,
j'ai créé un type de variable me permettant de stocker toute les informations facilement:
Code:
1 2 3 4 5 6
| Public Type transaction
nom As String
nb_mot_cle As Integer
mot_cle() As String
lien As String
End Type |
Aucun soucis pour le nom, nb_mot_cle ou lien par contre il m'est impossible de redimensionner/utiliser mot_cle().
Code:
1 2 3 4 5 6 7 8
|
Sub correction()
Dim transaction_correction() As transaction
ReDim Preserve transaction_correction(0).mot_cle(0)
End Sub |
J'obtiens Erreur d’exécution '9' : l'indice n’appartient pas à la selection.
Ce code marche par contre:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
Public Type transaction
nom As String
nb_mot_cle As Integer
mot_cle(100) As String
lien As String
End Type
Sub main()
Dim transaction_correction() As transaction
ReDim Preserve transaction_correction(0)
transaction_correction(0).mot_cle(0) = "salut"
End Sub |
Seulement j'ai besoin de garder un taille variable pour le tableau mot_cle().
Est-il possible en VBA de créer ce que j'essaye de faire? Je ne fait pas ce qu'il faut pour redimensionner?
Merci de votre aide!