View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
vivmaha vivmaha is offline
external usenet poster
 
Posts: 42
Default Placing a user defined type in a Collection

Hi,

I'm trying to make a collection in which i place variables of a type that i
defined.
I keep getting an error message. What is the problem?

The error message:
"Compile error: Only user-defined types defined in public object modules can
be coerced to or from a cariant or passed to late-bound functions"

The code (and where the error is thrown):
Public Type myType
stuff As Integer
End Type

Sub main()

Dim box As Collection
Set box = New Collection

Dim myVar As myType
myVar.stuff = 1

box.Add myVar '<-THIS IS WHERE I GET THE ERROR

End Sub