Function Comparisons Class

CanBeLong

Determine if the argument can be converted to a Long (Integer) value.

Signature (Visual Basic / VBA)

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

Code Example

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

Parameters

Parameter Description
vValue The argument which is checked to see if it can be converted to a Long (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 Long data type. Function returns False otherwise, such as if vValue is out-of-range, Null, an error, or an object pointer.