We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

How does one interrupt a running macro?

asked 2018-01-08 01:52:23 +0200

theGeeko61 gravatar image

I'm studying LibreOffice Basic for macros. I have a long-running macro which, once I determine a bug, I would like to abort the macro. I've tried CTRL-C but that does not work. I'm running on Linux, if that matters. I am grateful for any insight into this issue.

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2018-01-08 06:03:08 +0200

Ratslinger gravatar image


Much of the information regarding LO can be found in the many locations of LO help. Off-line help (if you installed it) states to use Ctrl+Shift+Q from within the Basic IDE. Shift+F5 also works in the IDE as well as pushing the Stop Macro toolbar button.

If this answers your question please tick the ✔ (upper left area of answer). It helps others to know there was an accepted answer.

edit flag offensive delete link more


This is the correct answer. Although it's in the offline documentation, I could not find it online. The only official information online is the bug report at https://bz.apache.org/ooo/show_bug.cg....

Jim K gravatar imageJim K ( 2018-01-08 22:49:55 +0200 )edit

For online see the 5.4 Help which came from here. The Shift+F5 came from hovering the mouse over the Stop icon.

Ratslinger gravatar imageRatslinger ( 2018-01-08 23:17:04 +0200 )edit

answered 2018-01-08 11:31:09 +0200

librebel gravatar image

Hello @theGeeko61,

For simple debugging i often just use the msgbox() function.

Code execution is halted until the msgbox dialog is dismissed.

So you could temporarily insert the following line into your code, at all places where you would like to be able to stop the macro:

If msgbox( "Should we STOP the Macro here?", 36 ) = 6 Then Stop

HTH, lib

edit flag offensive delete link more

answered 2019-07-15 19:26:56 +0200

You can add a temporary print statement to your macro. This works much like msgbox but has two option buttons; OK continues but Cancel aborts the macro. I often combine this with xray, which provides the detailed information I need to determine whether I've found what I'm looking for but has no abort option. xray object : print. This is especially useful when the time between xray statement invocations is too short for Ctrl+Shift+Q to work.

edit flag offensive delete link more

answered 2019-07-16 17:37:41 +0200

Pull down “Run”. All your options are there. When done compile, to make sure it still is able to run. I do very little in Macro’s, but, to go to a macro to work in it. Toos/Macros/edit macros. Then in Object Catalog go to your file, then Standard then your Module, double click your Module or the Sub you are wanting to work in. Seems you already know how to do those steps. Click in your Sub where you want it to stop, then pull down “Run”. All your options are there. When done compile, to make sure it still is able to run.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-01-08 01:52:23 +0200

Seen: 2,467 times

Last updated: Jul 16 '19