These are the rules from VBA https://msdn.microsoft.com/en-us/library/ee177324.aspx?f=255&MSPPError=-2147217396
The point is that variables (though not objects) always have a usuable value (objects do have a value of nothing).
5.5.1.2.2 Let-coercion to and from Boolean
When not stored as a Boolean value, False is represented by 0, and True is represented by nonzero values, usually -1.
The semantics of Boolean Let-coercion depend on the source’s value type and the destination’s declared type:
Source Value Type Destination Declared Type Semantics
Boolean Boolean The result is a copy of the source value.
Boolean Any numeric type except Byte If the source value is False, the result is 0. Otherwise, the result is -1.
Boolean Byte If the source value is False, the result is 0. Otherwise, the result is 255.
Any numeric type Boolean If the source value is 0, the result is False. Otherwise, the result is True
5.5.1.2.11 Let-coercion from Empty
The semantics of Empty Let-coercion depend on the destination’s declared type:
Source Value Type Destination Declared Type Semantics
Empty Any numeric type The result is 0.
Empty Boolean The result is False.
Empty Date The result is 12/30/1899 00:00:00.
Empty String The result is a 0-length string.
Empty String * length The result is a string containing length spaces.
Empty Any class or Object Runtime error 424 (Object required) is raised.
Empty Any other type except Variant Runtime error 13 (Type mismatch) is raised.
Your variable is coerced as a string when you first messagebox it.
Then it is coerced as false in line above.
5.6.9.5 Relational Operators
Relational operators are simple data operators that perform comparisons between their operands.
relational-operator = equality-operator / inequality-operator / less-than-operator / greaterthan-operator / less-than-equal-operator / greater-than-equal-operator
Static semantics:
Relational operators are statically resolved as simple data operators.
A relational operator is invalid if the declared type of any operand is an array or UDT.
A relational operator has the following declared type, based on the declared type of its operands:
Left Operand Declared Type Right Operand Declared Type Operator Declared Type
Any type except an array, UDT or Variant Any type except an array, UDT or Variant Boolean Any type except an array or UDT Variant
Variant Any type except an array or UDT Variant
Runtime semantics:
Relational operators are first evaluated as simple data operators.
If the value type of any operand is an array or UDT, runtime error 13 (Type mismatch) is raised.
Before evaluating the relational operator, its non-Null operands undergo Let-coercion to the operator’s effective value type.
The effective value type is determined as follows, based on the value types of the operands:
5.6.9.5.1 = Operator
The = operator performs a value equality comparison on its operands.
equality-operator = expression "=" expression
Runtime semantics:
If the operands are considered equal, True is returned. Otherwise, False is returned.