Since the OP seems to at least be familiar with LibreOffice Basic as well as VBA, he should note that there is no Immediate window within the LibreOffice IDE. Using debug.print will not work. LibreOffice's version of debug.print comes bundled within a whole library of functions which can be used from the a library set called "ScriptForge". More information about "ScriptForge" can be found at https://help.libreoffice.org/7.5/en-US/text/sbasic/shared/03/lib_ScriptForge.html?DbPAR=BASIC
In order to get access to the ScriptForge's exception handling functions, you will need to invoke the service "Exception". This opens all of the functionality for error handling and display and it includes it's own version of debug.print. Please note, you do not have to encounter an error in order to use this service. Please see the code below for how I implemented (note that the code as it stands will not have any error).
Sub Main
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
createscriptservice("Exception")
SF_Exception.consoleClear()
for x = 0 to 100
SF_Exception.debugprint(x)
next x
SF_Exception.console()
End Sub
One of the main drawbacks of the debugprint subroutine is that it is not just simply one line of code. You will invoke the debugprint subroutine, but then you have to invoke the console. The console is also a bit of a problem. The console is basically a modal window. So the program pauses until you close the window. Granted there is a button to close the window, but it would be great to continue debugging the code along with displaying any output to debugprint console. Hope this helps.