TYPEOF exp1

Returns the object data type.


exp1The expression evaluating to a reference data type.

REMARKS
* This operator is always used in conjunction with the Is keyword.
* This cannot be used with value data types, only reference data types.
* You can use the TYPENAME function to return the data type as a string.
* You can use the VARTYPE function to return a number indicating the data type.

result = TypeOf expression Is typename 
result = Not TypeOf expression Is typename

Dim ctrl As Control
For Each ctrl In Me.Controls
   If TypeOf ctrl Is MSForms.TextBox Then
      ctrl.Text = vbNullString
   End If
Next ctrl

Set fs = New Scripting.FileSystemObject
If TypeOf fs Is Scripting.FileSystemObject Then
End If

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top