Is there a better way to control periodic interval processing?
Also is there a way to terminate the existing WaitUntil?
See attached spreadsheet for demonstration.
Start_Stop_Interval_Processing.ods (12.6 KB)
LibreOffice BASIC not Python etc.
Thanks
REM ***** BASIC *****
Sub Start_Stop_Interval_Processing(oEvent As Object)
oModel = oEvent.Source.getModel()
If oModel.Label = "Start - Interval Processing" Then
oModel.Label = "Stop - Interval Processing"
While oModel.Label = "Stop - Interval Processing"
Call Interval_Processing()
WEnd
Else
' Is there a way to terminate the existing WaitUntil?
oModel.Label = "Start - Interval Processing"
End If
End Sub
Sub Interval_Processing()
With ThisComponent.Sheets.getByName("Sheet1")
Cell = .getCellRangeByName("A1")
Cell.setValue(Cell.getValue + 1)
End With
TimeToRun = Now() + TimeValue("00:00:05")
If TimeToRun < Now() Then Exit Sub
WaitUntil TimeToRun
End Sub