具有包含数组的自定义类型的VBA字典

时间:2018-06-25 12:34:51

标签: excel vba dictionary

之前问过一个问题,但我可能不清楚。因此,建议我使用字典来搜索项目。但是我无法确定如何将其用于数组。我的对象类如下:

Private index As Integer
Private id As String
Private nameID() As Variant
Private data() As Variant
Private cnt As Integer

Public Sub init(value As Integer)
    index = 0
    cnt = value
    id = ""
    ReDim nameID(0 To cnt)
    ReDim data(0 To cnt)
End Sub

Property Let setID(value As String)
    id = value
End Property

Property Let setName(value As String)
    nameID(index) = value
End Property
Property Let setNameArray(value As Variant)
    nameID = value
End Property

Property Let setData(value As String)
    data(index) = value
    index = index + 1
End Property

因此,我想将此内容导入字典,以便在这种情况下可以搜索特定的键或nameID's。 nameID和data都是包含我的ID及其值的数组。有没有办法在字典中做到这一点,或者我可以将其导入吗?

插图:

enter image description here

0 个答案:

没有答案