Libre Office Calc 与 Excel

Libre Office Calc Vs Excel

我的公司将从 Excel 更改为 Libre Office Calc。我已经建立了一个 Excel VBA 宏的集合(尤其是屏幕抓取宏)。我的宏可以在不做任何更改的情况下工作吗?还有人改过吗,请问你们是怎么改的很顺利的?

在大多数情况下,如果不将宏从 VBA 转换为 Libre Office Basic,这将无法工作。在执行切换到 Libre Office 以进行平滑切换之前,您需要重写并测试它们。

可能已经由 Rubber Duck 回答了

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.

此 post 还表明,部分 VBA 宏可以工作,但需要一些手动迁移。 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

最终,您可能必须仔细检查每一个并检查它是否正常运行。