That's a technique that I've implemented any number of times. It
works.
If you would like someone to help you, you need to provide the code
that doesn't work, not just unconnected snippets.
What is the type of Class1's Key? What is the value of Obj.Key when
you add the object to the collection?
How are A and B related? When and in what sequence are they called?
What is the value of B's argument Key when it doesn't work?
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article .com,
says...
This was just an example to say
Public c As Collection
Sub A
Dim Obj As Class1
Set Obj = New Class1
... Some settting of values and key
Set c=New Collection
c.Add Obj, Obj.Key
End Sub
Sub B( Key As String)
Dim Obj As Class1
Set Obj=c(Key) --- this is not working
'Set Obj=c.Item(Key) --Neither is this
End Sub
-Megha