Macros in Microsoft Office and LibreOffice
With a few exceptions, Microsoft Office and LibreOffice cannot run the same macro code. Microsoft Office uses VBA (Visual Basic for Applications) code, and LibreOffice uses Basic code based on the LibreOffice API (Application Program Interface) environment. Although the programming language is the same, the objects and methods are different.
The most recent versions of LibreOffice can run some Excel Visual Basic scripts if you enable this feature at
Tools - Options' - Load/Save - VBA Properties'.
If you use macros in one of the applications and want to use the same functionality in the other application, you must edit the macros. LibreOffice can load the macros that are contained within Microsoft Office files and you can then view and edit the macro code in the LibreOffice
Basic IDE editor.
You can choose to preserve or delete VBA macros
Open a Microsoft Office document that contains VBA macro code. Change only the normal contents (text, cells, graphics), and do not edit the macros. Save the document as a Microsoft Office file type. Open the file in Microsoft Office, and the VBA macros will run as before.
You may delete the VBA macros from the Microsoft Office file on loading or on saving.
- Choose 'Tools - Options' - Load/Save - VBA Properties to set the VBA macro handling of LibreOffice.