Table of contents
TOC
Collapse the table of content
Expand the table of content

Forward reference to user-defined type

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

A user-defined type must be defined before it can be referenced. This error has the following causes and solutions:

  • You declared a variable with a user-defined type before the definition of the user-defined type appears. In the following example, the variable OtherVar is declared before its type ( OtherType) is known:
Type MyType 
OtherVar As OtherType 
End Type 

Type OtherType 
WholeVar As Integer 
RealVar As Double 
End Type 
Reposition the type definitions so that the forward reference doesn't occur.
  • You nested a user-defined type within itself.
Type MyType 
MyVar As Integer 
OtherVar As MyType 
End Type 
 Remove the self-referencing nested type. This may occur indirectly if you nest a type within another type in which the first is already declared. Check the definition of each nested type to eliminate duplication.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

© 2018 Microsoft