What's the best language to use for calc macros?

Should I write macros for calc in LIbreOffice Basic or in Python or some other language?

Do you have any programming background? If so and if you already know Python, then by all means do use it in Calc. All functions of the LibreOffice API can be accessed from the different languages; it is easier for beginners to use StarBasic, as it is straightforward, but Python is more “powerful”, in a way, because it allows you to create new “UNO services”, which more or less means adding new functionality that didn’t exist in LibreOffice to begin with.

On the other hand, statements and functions are generally more verbose in, e.g., Python and JavaScript, than the equivalent statements and subroutines in Basic. At any rate, it is necessary to first understand the API functions (see the OpenOffice documentation wiki) before setting out to write complex macros.

Finally, it is important to note that the macros recorded with the experimental macro recorder use Basic, but do not use the API calls; instead, they use a service called the dispatcher, which is limited to emulating the commands issued by the user through the graphical user interface.

1 Like

please
how to code an object variable and use it. I created a form out of Calc, with Dialog1 containing 2 command buttons (start and end) 1 box text. At the start button opens box question (inputbox) and the variable containing the response, showing in the text box (textField1). I need the codes written in Module1. thank you

Hi @RenatoOlechnovicius, Please take the content of your Answer and ask it as a new Question. Thanks!

Yeah, Python! I really came here to find out if Python works reliably with calc.

Oops, I guess you meant to post a comment and posted an answer instead ;-). I do not know for sure wether Python is more stable than StarBasic for Calc macros, but I do know that it can access the complete API. See the API documentation and this article: http://wiki.openoffice.org/wiki/Python