Coding⏱️ 3 min read📅 2026-06-15

How to Fix: When debugging LibreOffice macro's, how do I get the error messages?

Debugging LibreOffice macros without GUI, error messages and variable inspection.

Quick Answer: Use the --debugger option with the macro call to enable a debugger that can inspect variables and provide more detailed error information.

Debugging LibreOffice macros can be challenging, especially when running them from the command line without a GUI. The error message displayed in the macro editor is often not informative enough to identify the issue. In this guide, we will walk you through the steps to troubleshoot and debug your LibreOffice macro.

This guide is intended for users who are familiar with basic programming concepts and have experience working with LibreOffice macros. If you're new to scripting, it's recommended to start with some basic tutorials before attempting to debug your macro.

⚠️ Common Causes

  • The first main reason why this error happens is that the macro is not properly formatted or contains syntax errors. This can be due to incorrect usage of LibreOffice API functions, missing or mismatched brackets, or incorrect data types.
  • Another alternative reason for this error could be that the macro is trying to access a resource or object that does not exist in the current scope. This might happen if you're trying to access a non-existent document or sheet.

🚀 How to Resolve This Issue

Enable Debugging with LibreOffice's Built-in Debugger

  1. Step 1: To enable debugging, open your macro in the macro editor and go to Tools > Macros > Options > Debugging. Check the box next to 'Enable debugger'.
  2. Step 2: Set a breakpoint at the line where you suspect the error occurred by clicking on the line number and pressing F9 (Windows) or Command + Shift + R (Mac).
  3. Step 3: Run your macro in debug mode using the 'Run' button or press F5. The debugger will pause execution at the breakpoint, allowing you to inspect variables and step through code.

Use External Tools for Debugging

  1. Step 1: Install an external tool like PyDev for Python or Eclipse for Java, which can provide more advanced debugging features.
  2. Step 2: Configure the external tool to run your macro as a script and attach to the LibreOffice process. This will allow you to step through code and inspect variables in real-time.

💡 Conclusion

By following these steps, you should be able to identify and debug issues with your LibreOffice macro. Remember to always check your macro's syntax and formatting, and use debugging tools to step through code and inspect variables.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions