I believe I have found a major bug in OpenOffice. It is applicable to any file that enables the user to execute macros. Specifically, when you try to rapidly execute macros, they are not carried out correctly. If you run one macro first and then attempt to run a second macro before the first one has finished, you can corrupt the data you are working with. I have a spreadsheet that uses macros and buttons and this bug just renders the data inaccurate. I have done searches for my problem but have not found a similar situation.
I have created a demonstration Calc file with two macros to illustrate my point. You can retrieve the file from http://cid-c3d66c73859f43b5.skydrive.li ... f%20Macros
The demonstration provides a button for you to press that increments 101 numbers each time you press the button. If you press the button slowly, the macro executes until it is finished and correctly increments the 101 numbers. If you press the button rapidly, say 20 times as fast as you can click, the the sequence of numbers gets corrupted. You will get numbers that are out of order and of the wrong value in the sequence.
Below is the two macros the program uses. The second macro is just to set the numbers from 1 to 101.
Code: Select all
Sub Increase_Numbers
REM *** Increments each of the 101 numbers in the first column of the spreadsheet by 1 ***
oDocument = ThisComponent
oSelectedCells = oDocument.CurrentSelection
oActiveCells = oSelectedCells.RangeAddress
oSheets = oDocument.Sheets
oSheet = oSheets.getByIndex(oActiveCells.Sheet)
i = 100
m = 0
For j = 0 to i
k = oSheet.getCellByPosition(0, j).getValue()
oSheet.getCellByPosition(0, j).setValue(k+1)
REM *** Delay loop to simulate real world calculations ***
For l = 0 to 1000
m = m + l
Next l
Next j
End Sub
Code: Select all
Sub Reset_Numbers
REM *** Fills the first column of the spreadsheet with ascending numbers from 1 to 101 ***
oDocument = ThisComponent
oSelectedCells = oDocument.CurrentSelection
oActiveCells = oSelectedCells.RangeAddress
oSheets = oDocument.Sheets
oSheet = oSheets.getByIndex(oActiveCells.Sheet)
i = 100
For j = 0 to i
oSheet.getCellByPosition(0, j).setValue(j+1)
Next j
End Sub