View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default User-defined type not defined

A UDT is not a typelib! Typelibs require a reference; UDTs require
definition same as variables do.

"User-defined type not defined" error suggests you're passing a ref to
a UDT that doesn't exist. For example...

Type udtMyType
My1 As Boolean: My2 As Long: My3 As String
End Type
Public MyType As udtMyType

...and somewhere in code you'd use these like this...

Sub InitGlobals
MyType.My1 = ThisWorkbook.Saved
If MyType.My1 Then
MyType.My2 = 1: MyType.My3 = "Yes"
Else
MyType.My2 = 0: MyType.My3 = "No"
End If
End Sub

...where this will compile without error. Note that as soon as you type
"MyType." intellisense displays the list of types as defined in your
Type declaration.

Trying to compile 'MyType.My0' will throw an error!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion