I want to pass a dictionary as a parameter. My code may seem a bit strange, but I'll show it anyway:
Sub get_Insurers_Dictionary()
Dim cInsurers As c_Insurers
Dim myDictionary As Scripting.Dictionary
Set cInsurers = New c_Insurers
Set myDictionary = New Scripting.Dictionary
Set myDictionary = cInsurers.Get_Parameters_Dictionary(cInsurers, myDictionary)
End Sub
Then in the c_Insurers class:
Public Function Get_Parameters_Dictionary(cInsurers As c_Insurers, myDictionary As Dictionary) As Dictionary
Dim oSheet As Excel.Worksheet
Dim cParameters As c_Parameters
Set oSheet = ThisWorkbook.Sheets("Parameters_Insurers")
oSheet.Activate
Set cParameters = New c_Parameters
Set cParameters = cParameters.Get_Parameters(cParameters, oSheet)
Me.fPartner_ID_Col = cParameters.get_Header_Cols(oSheet, cParameters.fMax_Col, "INSURER_ID")
Me.fPartner_Name_Col = cParameters.get_Header_Cols(oSheet, cParameters.fMax_Col, "INSURER_NAME")
Me.fCountry_Col = cParameters.get_Header_Cols(oSheet, cParameters.fMax_Col, "COUNTRY")
For lcnt = 1 To UBound(cParameters.fArray)
myDictionary.Add cParameters.fArray(lcnt, Me.fPartner_ID_Col), Me.Get_Parameters_Class(cInsurers, cParameters, lcnt)
Next lcnt
Set Get_Parameters_Insurers = myDictionary
Set cParameters = Nothing
End Function
Aside from the seemingly complex code, my question is simple: is it even possible to add a class object as item? (I'm not used to working with dictionaries yet). My dictionary is filled in in the c_insurers class, but why is it empty when I get back to the get_Insurers_Dictionary?