Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libre Office Calc Vs Excel

My company will be changing from Excel to Libre Office Calc. I have built up a collection of Excel VBA Macros (especially screen scrape macros). Will my Macros work without changes? Anybody else that has made the change, how do you make the change smoothly?

like image 233
Anthony Avatar asked Oct 31 '25 12:10

Anthony


2 Answers

Possible already answered by Rubber Duck https://stackoverflow.com/a/24749320/7326037

From LibreOffice's online help file:

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 LibreOffice - PreferencesTools - Options - Load/Save - VBA Properties. In reality, you would most likely need to sit down with the LibreOffice API and rewrite the functionality.

This post also suggests that at parts of the VBA macros will work but will require a bit of manual migration. https://ask.libreoffice.org/en/question/6621/import-ms-word-macros/?answer=6982#post-id-6982

In ODF/ODS files you have to enable VBA support at the beginning of the macro, otherwise it expects LO-Basic:

Option VBASupport 1
Option Compatible

Ultimately, you're probably going to have to go through each one and check that it functions correctly.

like image 155
Antony O'Neill Avatar answered Nov 03 '25 10:11

Antony O'Neill


In most cases this won't work without converting the macros from VBA to Libre Office Basic. You will need to rewrite them and test them before you perform the switch to Libre Office to make a smooth switch.

like image 41
Pᴇʜ Avatar answered Nov 03 '25 10:11

Pᴇʜ