Here's a short little macro. It reads the contents of cell A1 of Sheet1 into an integer
variable called "buy", and the contents of cell B1 into a currency variable called "cost".
The product of those two numbers is a currency variable called "total", which is then
written into cell C1.
Code: Select all
Sub Main
Dim oSheet as object, oCell as object
Dim cost as currency, total as currency
Dim buy as integer
oSheet=ThisComponent.Sheets.getByName("Sheet1")
oCell=oSheet.getCellByPosition(0,0) 'A1
buy = oCell.getValue
oCell=oSheet.getCellByPosition(1,0) 'B1
cost = oCell.getValue
total = buy*cost
oCell=oSheet.getCellByPosition(2,0) 'C1
oCell.setValue(total)
End Sub
as expected.
If you now change B1 to 50000 and execute the macro again, C1 doesn't contain the expected
value of 250000 - on my computer, it's now 38,252,449,584,978.1. (It works fine if I change
cost and total from type currency to type long, but that's treating the symptoms, not addressing
the problem.
Looks to me like some kind of overflow. Where/how/to whom do I report this?
Lorenzo