Method: IsEmpty for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: IsEmpty for VBS
Method: IsEmpty for VBS
Specifies whether an expression contains a non-initialized variable.
vIsEmpty = Object.IsEmpty(expression)
| Object | VBS Object with this method. You do not need to specify this object. |
| expression | Variant Specifies any expression. |
| vIsEmpty | Variant The IsEmpty method returns True if the expression contains a non-initialized variable. Otherwise the method returns False. In contrast to the value Empty, the value Null indicates that an expression contains invalid data. |
The following example checks whether a variable was initialized:
Dim MyVar Call MsgBox(IsEmpty(MyVar)) 'Returns True MyVar = Null Call MsgBox(IsEmpty(MyVar)) 'Returns False MyVar = Empty Call MsgBox(IsEmpty(MyVar)) 'Returns True Set MyVar = Nothing Call MsgBox(IsEmpty(MyVar)) 'Returns False