在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