1
我有一組所有者,每個所有者都有自己的一組機會。VBA將對象傳遞到另一個對象集合
我有兩個類模塊,ClmOpportunity具有一束性質的,和ClmOwner其具有單一的名稱屬性和集合存儲ClmOpportunity對象:
Public name As Variant
Private opps As New collection
Public Function addOpportunity(opp As ClmOpportunity)
opp.ID = opps.Count + 1
opps.Add opp, opps.Count + 1
End Function
這些所有者對象也被存儲在集合中在我的主模塊中。當我嘗試使用功能addOpportunity如下圖所示:
Dim item As New ClmOpportunity
item.name = "test"
owners.item(overallOwner).addOpportunity (item)
我得到的錯誤:
"object doesn't support this property or method"
我很新的VBA,我不明白這是爲什麼,我傳遞在ClmOpportunity中,所以它應該沒問題吧?
任何幫助將不勝感激!
感謝你的回覆 – Steven