Function Comparisons Class

CanBeInteger

Determine if the argument can be converted to an Integer value.

Signature (Visual Basic / VBA)

Public Function CanBeInteger( _
    ByVal vValue As Variant _
    ) As Boolean

Code Example

    CanBeInteger(34) = True
    CanBeInteger(1234.56) = True
    CanBeInteger(123456) = False
    CanBeInteger(#12/31/2020#) = False
    CanBeInteger("1") = True
    CanBeInteger("A word.") = False

Parameters

Parameter Description
vValue The argument which is checked to see if it can be converted to an Integer value. Function returns True if vValue contains a numeric value, a date, or a numeric string value which is within the range of values supported by the Integer data type. Function returns False otherwise, such as if vValue is out-of-range, Null, an error, or an object pointer.