Funció DoEvents

Transfers control to the operating system during macro execution, so that it can process the events in waiting.

note

DoEvents provides compatibility with VBA. It always returns 0. Using it in Collabora Office is not necessary.


Sintaxi:

[Call] DoEvents[()] As Integer

Exemple:

Both examples set a progressive counter on the first cell of a newly opened Calc document.

Sub DoEventsExample
    Dim i As Long, sheet As Object, cell As Object
    sheet = ThisComponent.Sheets.getByIndex(0) ' full 1
    cell = sheet.getCellByPosition(0,0) ' cel·la A1
    For i = 1 To 20000
        cell.setString(Str(i))
        DoEvents
    Next i
End Sub ' DoEventsExample
Sub DoEvents_example
    Dim i As Long, ui As Object
    GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
	Set ui = CreateScriptService("SFDocuments.Calc", ThisComponent)
    For i = 1 To 20000
        ui.SetValue("A1", i)
        DoEvents
    Next i
    ui.Dispose()
End Sub ' DoEvents_example

Ens cal la vostra ajuda!