TYPEOF

result = TypeOf expr

Returns the object data type.


exprThe expression evaluating to a reference data type.

REMARKS
* This is an operator.
* This operator is always used in conjunction with the IS Operator
* This cannot be used with value data types, only reference data types.
* You can use the TYPENAME function to return the data type of the variable 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

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