Symptoms
A limitation of the Microsoft Visual Basic for Applications Collection object is that it cannot contain a user-defined data type. You can achieve similar functionality, however, by creating a collection that contains the elements that you would normally define in your user-defined data type, and then storing that collection in a second collection. This article shows you how to create such a nested collection.
Resolution
To create a collection within a collection, follow these steps:Create a module, and then type or paste the following procedure:

Function CollectionCollection()Dim elementDim insideCollection As New CollectionDim outsideCollection As New Collection’ Populate the first element of the collection and add’ it to the parent collection.insideCollection.Add KEY:=”fname”, Item:=”joe”insideCollection.Add KEY:=”lname”, Item:=”smith”insideCollection.Add KEY:=”age”, Item:=12outsideCollection.Add insideCollection’ Clear the collection – prevents duplication of elements.Set insideCollection = Nothing’ Populate the second element of the collection and add’ it to the parent collection.insideCollection.Add KEY:=”fname”, Item:=”fred”insideCollection.Add KEY:=”lname”, Item:=”smith”insideCollection.Add KEY:=”age”, Item:=14outsideCollection.Add insideCollection’ Print the contents of the parent collection to the Debug window.For Each element In outsideCollectionDebug.Print element(“fname”), element(“lname”), element(“age”)NextEnd Function To test the function, on the View menu, click Immediate Window, type the following command, and then press ENTER:
CollectionCollectionNote that the contents of the collection appear in the Immediatewindow.