5.6.7 TypeOf…Is Expressions

A TypeOf...Is expression is used to check whether the value type of a value is compatible with a given type.

 typeof-is-expression = "typeof" expression "is" type-expression 

Static semantics. A TypeOf...Is expression is classified as a value and has a declared type of Boolean. <expression> MUST be classified as a variable, function, property with a visible Property Get, or unbound member and MUST have a declared type of a specific UDT, a specific class, Object or Variant.

Runtime semantics. The expression evaluates to True if any of the following are true:

§ The value type of <expression> is the exact type specified by <type-expression>.

§ The value type of <expression> is a specific class that implements the interface type specified by <type-expression>.

§ The value type of <expression> is any class and <type-expression> specifies the type Object.

 Otherwise the expression evaluates to False.

If the value type of <expression> is Nothing, runtime error 91 (Object variable or With block variable not set) is raised.