Placing a user defined type in a Collection


G

Guest

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
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top