CType Function

Syntax:

CShort(expr )

Group:

Conversion

Description: 

Converts an expr to the specified objtype type. Conversion include inheritance, implementation and value conversion. If the expr can't be converted, a "type mismatch error" will occur.

Parameters:

Parameter

Description

expr

Converts the value of this expression.

objtype

Converts to this type.

Example:

Sub Main
  Debug.Print CType(1.1, Integer) ' 1

  Dim V As Object

  V = Err

  Debug.Print TypeName(CType(V, ErrObject)) ' ErrObject
End
Sub