CLng (function)

Syntax CLng (expression)
Description Converts expression to a Long .
Comments This function accepts any expression convertible to a Long , including strings. A runtime error is generated if expression is Null . Empty is treated as 0 . The passed expression must be within the following range:
  –2147483648 <= expression <= 2147483647
A runtime error results if the passed expression is not within the above range. When passed a numeric expression, this function has the same effect as assigning the numeric expression to a Long . Note that long variables are rounded before conversion. When used with variants, this function guarantees that the expression is converted to a Long variant ( VarType 3 ).
Example This example displays the results for various conversions of i and j (note rounding).
Sub Main()
  I% = 100
  j& = 123.666
  MsgBox "The result of i * j is: " & CLng(i% * j&)  'Displays 12367.
  MsgBox "The new variant type of i is: " & Vartype(CLng(i%))
End Sub
See Also CCur (function); CBool (function); CDate, CVDate (functions); CDbl (function); CInt (function); CSng (function); CStr (function); CVar (function); CVErr (function); Long (data type).