I have created a user-defined-type like this in my form in VB6.
I tried putting a variable of this type, into a variable of type Variant, but I got the error "Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions".Code:Private Type Rational Numerator As Long Denominator As Long End Type
I then tried changing the declaration of the type to Public, and put it inside a VB6 module like this.
But I still ended up getting the same error.Code:Public Type Rational Numerator As Long Denominator As Long End Type
Since then I've read that you can't do that, unless you do one of 3 things:
1) Use a Class instead of a UDT
2) Put the UDT in an ActiveX DLL file and register the DLL file
3) Put the UDT in a TypeLib (a file with the TLB file extension)
I already know how to do the first 2 of those techniques. I'm interested in doing #3 in that list. How do I create a TypeLib in VB6 that contains the desired UDT? Can somebody here tell me how to do it, and if it requires additional TypeLib making software, please point me to a place to download or purchase such software.




Reply With Quote