Dictionnaire de dictionnaire - Module de Classe
Bonjour,
Mon problème est le suivant : J'aimerai insérer un dictionnaire dans un autre dictionnaire. Le second dictionnaire se trouve dans un module de classe "Program_Parameters" parmi d'autres variables. De même il existe un module de classe "Tag_Parameters" pour stocker les variables du deuxième dictionnaire.
Le code permettant le remplissage des dictionnaire compile correctement :
Code:
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Sub Fill_Dic_Program_P()
Dim CM_Program_P As New Program_Parameters
Dim CM_Tag_P As New Tag_Parameters
Dim I As Long
Dim J As Long
Dim Key_i As String
Dim Tag_j As String
Set Dic_Program_P = Nothing
Set Dic_Program_P = New Dictionary
With ThisWorkbook.Sheets(MySheet).Range(MyRange)
For I = 1 To .Rows.Count
Key_i = .Cells(I, 1)
With ThisWorkbook.Sheets(TAG_P_SheetName).Range(Tag)
For J = 1 To .Rows.Count
Set CM_Program_P.Dic_Tag = Nothing
Set CM_Program_P.Dic_Tag = New Dictionary
Tag_j = .Cells(J, 1).Value
CM_Tag_P.Tag_Output = X
CM_Tag_P.Tag_Value = Y
If Not CM_Program_P.Dic_Tag.Exists(Tag_j) Then
CM_Program_P.Dic_Tag.Add Tag_j, CM_Tag_P
End If
Set CM_Tag_P = Nothing
Next J
End With
'***
If Not Dic_Program_P.Exists(Key_i) Then
Dic_Program_P.Add Key_i, CM_Program_P
End If
Set CM_Program_P = Nothing
Next I
End With
End Sub |
Mais c'est en voulant accéder aux informations du deuxième dictionnaire que j'ai un problème.
J'ai essayé :
Code:
1 2 3
|
Test_1 = Dic_Program_P.Item(Key_i).Dic_Tag.Item(Tag_j).Tag_Output |
Mais j'obtiens l'erreur 424 : objet requis.
Je suis à votre disposition pour plus de détails
Merci pour votre aide,
Nicolas