TypeOf (function)

Syntax

TypeOf objectvariable Is objecttype

Description

Returns TRUE if objectvariable is the specified typel; otherwise FALSE.

Comments

This function is used within the If...Then statement to determine if a variable is of a particular type. This function is particularily useful for determining the type of OLE automation objects.

Example

Sub Main()

  Dim a As Object

  Set a = CreateObject("Excel.Application")

  If TypeOf a Is "Application" Then

    MsgBox "We have an Application object."

  End If

End Sub

See Also

TypeName (function)

More information

T