VBA Adding a class to a collection

前端 未结 1 453
星月不相逢
星月不相逢 2020-11-27 07:22

I have a class module called Holding. In it are several public variables. My code is this:

Dim holdings as Collection
Dim h as Holding

Set holdings = new Co         


        
1条回答
  •  广开言路
    2020-11-27 08:18

    Remove the parentheses.

    holdings.Add h
    

    Otherwise you are trying to add to the collection the value of the default property of your Holding instance, and it doesn't have a default property.

    0 讨论(0)
提交回复
热议问题