有没有办法转换这个代码,使其与libreoffice兼容,或者我必须学习一个全新的语言像python?学习python不会是一个问题,但不是我的问题的解决方案,因为我有许多与excel相关的文件有很多vba代码,我不可能在工作中使用open office / libreoffice ...
我只想补充一点,在使用它的某些单元格中,SinceLastWash给出了正确的值,而在其他单元格中给出了错误,#NAME?
感谢
解决方案从 LibreOffice的在线帮助文件:
除了一些例外,Microsoft Office和LibreOffice无法运行相同的宏代码。 Microsoft Office使用VBA(Visual Basic for Applications)代码,LibreOffice使用基于LibreOffice API(应用程序接口)环境的基本代码。虽然编程语言是一样的,但是对象和方法是不同的。
如果您在LibreOffice中启用了此功能,LibreOffice的最新版本可以运行某些Excel Visual Basic脚本 - PreferencesTools - 选项 - 加载/保存 - VBA属性。
在现实中,你很可能需要坐下来 LibreOffice API 并重写功能。
I have recently migrated to pclinuxos from windows and seem to like it. The only problem I am facing is that libreoffice, the default spreadsheet package is not compatible with excel macros. Below is the vba code I have:
Option VBASupport Sub DeleteToLeft() Selection.SpecialCells(xlBlanks).Delete shift:=xlToLeft End Sub Function SinceLastWash() Application.Volatile WashCount = 0 WearCount = 0 CurrentRow = Application.ThisCell.Row For i = 3 To 35 If Range(Cells(CurrentRow, i), Cells(CurrentRow, i)).Value = "a" Then WearCount = WearCount + 1 End If If Range(Cells(CurrentRow, i), Cells(CurrentRow, i)).Value = "q" Then WashCount = WashCount + 1 WearCount = 0 End If Next i SinceLastWash = WearCount End Function Function testhis() testhis = Application.ThisCell.Row End FunctionIs there a way to convert this code to make it compatible with libreoffice or do I have to learn an altogether new language like python? Learning python would not be a problem but is not a solution to my problem as I have many work related files in excel which have a lot of vba code and it is not possible for me to use open office/libreoffice at work...
I just want to add that the function SinceLastWash gives the correct value in some cells where I use it and in others gives an error, #NAME?
Thanks
解决方案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.
更多推荐
如何使vba代码与libre office兼容
发布评论