Need step-by-step instructions to create new JavaScript Macro

I need to create a macro in Calc. I’ve searched this forum and Google without luck. Title says it all. If no one can help with the JavaScript feature, I’ll be happy with Python.

As of now, when I go to Tools | Macro | Organize Macros JavaScript and Python do not have the Create or Edit buttons enabled. Even worse, if I try to run any JavaScript sample, it crashes LibreOffice altogether. I’m pretty sure that this is not expected behavior.

If I run the Python macros, they opens LibreOffice Writer. lol

I’m running on Window 10.

Thanks in Advance! :slight_smile:

LO only provides an Editor for Basic Macros hence the Create and Edit buttons are not available for JavaScript and Python. You need to use an external Editor to Create or Edit these Macros.

The JavaScript and Python Macros supplied with LO are contained in Program Files (or Program Files (x86) for 32 bit version)/LibreOffice(ver)/share/Scripts.

If you run the Python Macro HellowWorld.py with a Writer document open it will append the text Hello World (in Python) to the document. If you do not have a Writer document open it will create a document to add the text as you have found. If you examine the Macro you will see that is what is intended.

To run the JavaScript Macro helloworld.js you must have a Writer document open. It does not create one. Again you can see the intended action by examining this Macro. There are problems with JavaScript Macros in some versions of LO.

In the default installation of LibreOffice that comes with Ubuntu 16.04.3, there’s only a Python directory under /usr/lib/libreoffice/share/Scripts.