View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jason Jason is offline
external usenet poster
 
Posts: 367
Default Using vb.net collections in VBA through COMClass

I've been using COMclass objects I create in vb.net (2003) from Excel VBA for
a while now, and I like the abilities it allows. Up until now, I haven't
needed to make a COMclass that includes a collection object (that inherits
from System.Collections.CollectionBase), but I just tried that now. When I
used the collection in VBA, I was surprised to see that it didn't show the
collection's Item() property in the Locals window, even though I declared it
as Public (as the default property). I was able to access items in the
collection in the Immediate window (e.g.: MsgBox collection.Item(1).prop1, or
collection(1).Prop1). However, when I tried to use the For..Each
functionality, I got a message saying the object doesn't support this
property or method. Is there something else I need to do when creating
collections in vb.net to allow them to be used properly in VBA?

Thanks,
Jason