Using a Range object with NewEnum() instead of Collection class (ie with For Each)
I'm building a custom collection class, Record.
I've currently enabled enumeration of my class by:
private pRecord as Collection
'
' Enables enumeration of the pRecords Collection (ie using For Each).
'
Public Property Get NewEnum() As IUnknown
开发者_如何学CAttribute NewEnum.VB_UserMemId = -4
Attribute NewEnum.VB_MemberFlags = "40"
Set NewEnum = pRecord.[_NewEnum]
End Property
Currently, pRecord is a Collection containing individual cells that is in a row of some Range object, eg Range("A1:C6").Rows(1).
Is it possible to set the actual row Range as the object that is enumerated instead of the the pRecords collection? If so, how do you do it?
I figure that this must be possible some how as you can already use For Each on range objects.
Have you tried substituting a Range object for your collection?
精彩评论