'VBA: Creating a class property that is an array of dictionaries
In Microsoft Excel VBA I need to create a class that has two properties, "Name" and "Holdings". "Name" is just a string so the code for that is easy. But I need "Holdings" to be a variable length array containing dictionary objects. So this is what I wrote:
Private mName As String
Private mHoldings() As Scripting.Dictionary
Public Property Let Name(vName As String)
mName = vName
End Property
Public Property Get Name() As String
Name = mName
End Property
Public Property Set Holdings(vHoldings() As Scripting.Dictionary)
Set mHoldings = vHoldings
End Property
Public Property Get Holdings() As Scripting.Dictionary
Set Holdings = mHoldings
End Property
When I try to compile it gives me this error: "Definitions of property procedures for the same property are inconsistent, or property procedure has an optional parameter, a ParamArray, or an invalide Set final parameter.
What I doing wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
