Hi,
I have written a class module.
I want to make one of the functions return a user defined type that i have defined as:
I have made this declaration in a the general section of a normal module. My function is defined as:Code:Public Type FirstLastLevel FirstLevel As Integer LastLevel As Integer End Type
When i try to run the program i get the following error message:Code:Public Function GetLevelRange(LowerHeight As Long, Upperheight As Long) As FirstLastLevel GetLevelRange.FirstLevel = 1 GetLevelRange.LastLevel = 4 End Function
Compile error:
Only public user defined types defined in public object modules can be used as parameters or return types for public procedures of class modules or as fields of public user defined types
Does anyone know if you can return user defined types from a class module procedure - it looks as though you can but i must be doing something wrong. I tried moving the type declaration into the class module but that didn't help wither.
What do they mean by "public object modules" - is this a class module or a normal module - or a special kind of one of these.
Any help would be greatly appreciated,
Mark




Reply With Quote