Here's a short little OO macro. (Sorry to post this, but I don't know how else to describe the problem.)
Code: Select all
Sub Main
Dim oDocument As Object, oSheet As Object, oCell As Object
Dim cost as currency
Dim total as currency
Dim buy as integer
oDocument = ThisComponent
oSheet=oDocument.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
Ok, easy enough. Let's enter some numbers in Sheet1. Set A1 to 5 and B1 to 40000. Run the macro, and sure enough, the product (200000) goes into C1.
Now change B1 to 50000 and run the macro again. Whoops! That's a bit wrong! Looks like some kind of overflow with the currency type. (If I change the two currency variables to type long, then it works fine - but, well, I want them to be type currency!)
I'm currently using OO 2.4.1, but the same thing happened earlier, with 2.3.x.
If this is a genuine bug, I'd be glad to submit a trouble report if I can figure out how to do that...
Lorenzo