Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在VBA中设置对象的集合属性_Vba_Class - Fatal编程技术网

在VBA中设置对象的集合属性

在VBA中设置对象的集合属性,vba,class,Vba,Class,我有一个以集合为属性的类 债券类别 Private pBondiSIN As String Private pBroker As Collection '''''''''''''''''''''' ' BondiSIN property '''''''''''''''''''''' Public Property Get BondiSIN() As String BondiSIN = pBondiSIN End Property Public Property Let BondiSIN

我有一个以集合为属性的类

债券类别

Private pBondiSIN As String
Private pBroker As Collection

''''''''''''''''''''''
' BondiSIN property
''''''''''''''''''''''
Public Property Get BondiSIN() As String
    BondiSIN = pBondiSIN
End Property
Public Property Let BondiSIN(Value As String)
    pBondiSIN = Value
End Property

''''''''''''''''''''''
' Broker property
''''''''''''''''''''''
Public Property Get Broker() As Collection
    Broker = pBroker
End Property
Public Property Let Broker(Value As Collection)
    pBroker = Value
End Property
我这样称呼它:

Set tempBond = New Bond
tempBond.Broker = New Collection  => Gives me a error as Wrong number of Arguments or Invalid property assignment
不确定如何解决此错误。需要这方面的帮助。

熟悉


对于复杂对象(如Collections)使用
Set
关键字何时使用let和何时使用Set?
Public Property Set Broker(Value As Collection)
    Set pBroker = Value
End Property
Set tempBond.Broker = New Collection