LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User-defined type collection in class module Rob[_29_] Excel Programming 2 May 31st 06 06:02 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM


All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"