[Solved] Debug a macro line by line

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
robbyn
Posts: 62
Joined: Sat Jun 26, 2021 10:01 pm

[Solved] Debug a macro line by line

Post by robbyn »

How do I switch on line by line debugging of a macro, so that it steps through the macro and waits after each line for a key to be pressed before moving to the next line?
Last edited by robbyn on Sun Sep 26, 2021 1:26 pm, edited 1 time in total.
Libreoffice v7.2.0.4 on Ubuntu 20.04 Locale en-GB
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Debug a macro line by line

Post by Zizi64 »

Try to insert a breakpoint to every lines of your subroutine/function.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Debug a macro line by line

Post by Villeroy »

F5 runs the routine where the cursor is in
F7 adds the variable name under the cursor to the watch window
F8 runs in step mode in the routine where the cursor is in.
Shift+F8 runs in step mode but running through the branching routines.
F9 adds a break point to the line where the cursor is in.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
robbyn
Posts: 62
Joined: Sat Jun 26, 2021 10:01 pm

Re: Debug a macro line by line

Post by robbyn »

Thank you for explaining the step approach.

Prior to your explanations I did not understand that the cursor needed to be in the macro on screen.
Libreoffice v7.2.0.4 on Ubuntu 20.04 Locale en-GB
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [SOLVED] Debug a macro line by line

Post by Villeroy »

OpenOffice always starts in the first routine of the current module.
Workaround:

Code: Select all

Sub TopRoutine()
TestRoutine
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply