> I have a question regarding a collection created using the VB class
> builder that I've imported and the for...each construct.  I've consulted
> on-line help and
> numerous books, and I am still a bit confused as to why something isn't
> working.
>

I don't know what the class builder is, but here's how I would do it:

 Have a class module called clsNode to contain the node itself.
 Have a class module called clsNodes to contain the collection of nodes.
 Have another module to test it.


*In class clsNode:*

 'Store the date when it was created
 Dim dtStart As Date

 Private Sub Class_Initialize()

 'When the class is instantiated, store the date/time
 dtStart = Now

 End Sub

 'Return the time it was instantiated
 Sub ShowWhen()

 MsgBox "I was created at " & Format(dtStart, "hh:mm:ss")

 End Sub


*In class clsNodes:*

 'Dim a local object to hold the collection
 Dim colNodes As New Collection

 'Routine to add a new class to the collection.
 'Returns the Node object created
 Function Add()

 'Create a new instance of the clsNode class
 Dim newNode As New clsNode

 'Add it to the collection
 colNodes.Add newNode

 'Return the node object created
 Set Add = newNode
 
 End Function 

 'Property to return the collection of nodes
 Property Get Nodes() As Collection

 'Return the collection object
 Set Nodes = colNodes

 End Property


*In the normal module to test it:*

 'Create a new instance of the Nodes class
 Dim decNodes As New clsNodes

 Sub Test()

 'Dimension a temporary object as type clsNode
 Dim myNode As clsNode

 'Create a new node in the collection and show when it was created
 Set myNode = decNodes.Add
 myNode.ShowWhen

 'Create a new node in the collection and show when it was created
 Set myNode = decNodes.Add
 myNode.ShowWhen

 'Create a new node in the collection and show when it was created
 Set myNode = decNodes.Add
 myNode.ShowWhen

 'Loop through the nodes in the collection, showing when each was created
 For Each myNode In decNodes.Nodes
    myNode.ShowWhen
 Next

 'Tidy up the collection object
 Set decNodes = Nothing

 End Sub


Hope this is clear enough .  In this example, I have prefixed the 
classes with "cls" so you can see when I am refering to a class, as 
opposed to a property or function.  If you rename the classes to remove 
the "cls", it still works fine, and you can do something like:

 Dim decNodes As New Nodes
 
 Sub Test()
 
 Dim myNode As Node
 ... 
 For Each myNode In decNodes.Nodes
    myNode.ShowWhen
 Next
 ...
 
I.e., the term Nodes refers both to the class object, and to a property 
within it.  This is in line with Excel's normal object naming/handling.  

The problem you were facing is that in Excel, each collection object has a 
default method/property, which returns the items it is a collection of.  
For example:

 For Each oCell In Selection
 
iterates through all the selected cells and is the same as

 For Each oCell In Selection.Cells

Most Excel collections contain only one type of object, and so have the 
secondary collection identifier (.Cells) invisible.  If this were not the 
case, we would have to write:

 For Each oSht In Worksheets.Worksheets

The Range collection, however, is both a collection of Cells and a 
collection of Areas at the same time, so we have to specify which 
collection we want.

When we create our own collection classes, we have no way (AFAIK) of 
specifying a default property/function/method of that class, so instead of 
using an implied:

 For Each myNode In decNodes
 
we have to use the explicit:

 For Each myNode In decNodes.Nodes

Of course, it would also be really nice if we could do:

 decNode.Nodes.ShowWhen

and have Excel handle the implied For Each... involved.

HTH (and was not too long)

Maybe I should write a book about this...

 Regards

 Stephen Bullen
 Microsoft MVP - Excel
 http://ourworld.compuserve.com/homepages/Stephen_Bullen