[Solved] Finish a Loop when closing form (window)
Posted: Fri May 17, 2019 3:21 pm
This should be really easy but I can't find it out. Im trying to do a loop for saving the form records(on a base) every minute. Which works but when I close the form the macro keeps running and eventually returns a unwanted error because form is no longer open:
What can I put on the While/Until for not returning this error?
This is my macroBASIC runtime error.
An exception occurred
Type: com.sun.star.lang.DisposedException
Message: Frame disposed.
Code: Select all
Sub Save_loop
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
Do While '???Window is open
dispatcher.executeDispatch(document, ".uno:RecSave", "", 0, Array())
wait 60000
Loop
End Sub