Calc BASIC function like oCell.getValue to handle long integers?

In the example below, getValue works with smaller long integers, but if a legitimate long integer gets to larger values, the program blows with a “Inadmissible value or data type.
Overflow.” error. Is there a function similar to getValue that works with any valid long integer? getLong seems to be associated with SQL.

dim x as long

oCell = oSheet.getCellByPosition(0,j)
x = oCell.getValue()

getValue doesn’t return a (long) integer, but a double. The error happens not in the function (your assumption that it cannot handle some of the numbers in the cell is wrong), but when you assign the value to your variable. Declare your variable as double, and round if you only need whole numbers.