5.6.2.2 Evaluation to a simple data value
Static semantics. The following types of expressions can be evaluated to produce a simple data value:
An expression classified as a value expression can be evaluated as a simple data value based on the following rules:
If the declared type of the expression is a type other than a specific class, Variant or Object, the declared type of the simple data value is that of the expression.
If the declared type of the expression is Variant or Object, the declared type of the simple data value is Variant.
If the declared type of the expression is a specific class:
If this class has a public default Property Get or function and this default member’s parameter list is compatible with an argument list containing 0 parameters, simple data value evaluation restarts as if this default member was the expression.
An expression classified as an unbound member, variable, property or function can be evaluated as a simple data value if it is both valid to evaluate the expression as a data value, and valid to evaluate an expression with the resulting classification and declared type as a simple data value.
Runtime semantics. At runtime, the simple data value’s value and value type are determined based on the classification of the expression, as follows:
If the expression is a value expression:
If the expression’s value type is a type other than a specific class or Nothing, the simple data value’s value is that of the expression.
If the expression’s value type is a specific class:
If the source object has a public default Property Get or a public default function, and this default member’s parameter list is compatible with an argument list containing 0 parameters, the simple data value’s value is the result of evaluating this default member as a simple data value.
Otherwise, if the source object does not have a public default Property Get or a public default function, runtime error 438 (Object doesn’t support this property or method) is raised.
If the expression’s value type is Nothing, runtime error 91 (Object variable or With block variable not set) is raised.
If the expression is classified as an unbound member, variable, property or function, the expression is first evaluated as a data value and then the resulting expression is reevaluated as a simple data value.