Ask Your Question

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

asked 2016-09-22 03:44:15 +0200

richb01 gravatar image

updated 2016-09-22 03:45:58 +0200

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! :-)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-09-23 12:57:32 +0200

peterwt gravatar image

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 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.

edit flag offensive delete link more


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.

dandv gravatar imagedandv ( 2017-10-14 22:54:26 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-09-22 03:44:15 +0200

Seen: 2,174 times

Last updated: Sep 23 '16