Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting User Types Into Collection Objects Error

Status
Not open for further replies.

martync

Programmer
Mar 4, 2002
7
AU
Hi, I have created a user type:
Private Type SampleInfo
SampleCode As String
SampleID As Long
SampleType As String
ProductType As String
End Type
Dim Info as Type

When I try to put Info into a collection object
Dim colInfo As New Collection
colInfo.Add Info

I get the following error returned:
"Compile error:
Only user defined types in public object modules can be coerced to or from a variant or passed to late bound function"

Am I trying to do the impossible? Any help appreciated.
By the way I have tried defining the type as a Public Type with no success.
 
I've managed to do this by putting the type statement into a class within a separate ActiveX DLL project, then referencing the project. It was only a quick test so I'm not 100% sure that this will work as you want but it may be a start for you.

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top