如何使vba代码与libre

如何使vba代码与libre

本文介绍了如何使vba代码与libre office兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从Windows迁移到pclinuxos,似乎喜欢它。我唯一遇到的问题是libreoffice,默认的电子表格包与excel宏不兼容。以下是vba代码:

  Option VBASupport 
Sub DeleteToLeft()
Selection.SpecialCells xlBlanks)。删除shift:= xlToLeft
End Sub
函数SinceLastWash()
Application.Volatile
WashCount = 0
WearCount = 0
CurrentRow =应用程序.ThisCell.Row
对于i = 3到35
如果范围(Cells(CurrentRow,i),Cells(CurrentRow,i))。Value =a然后
WearCount = WearCount + 1
End If
如果Range(Cells(CurrentRow,i),Cells(CurrentRow,i))。Value =q然后
WashCount = WashCount + 1
WearCount = 0
End If
Next i
SinceLastWash = WearCount
结束函数
函数testhis()
testhis = Application.ThisCell.Row
结束函数

有没有办法转换这个代码,使其与libreoffice兼容,或者我必须学习一个全新的语言像python?学习python不会是一个问题,但不是我的问题的解决方案,因为我有许多与excel相关的文件有很多vba代码,我不可能在工作中使用open office / libreoffice ...



我只想补充一点,在使用它的某些单元格中,SinceLastWash给出了正确的值,而在其他单元格中给出了错误,#NAME?



感谢

解决方案

在现实中,你很可能需要坐下来并重写功能。


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 Function

Is 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:

In reality, you would most likely need to sit down with the LibreOffice API and rewrite the functionality.

这篇关于如何使vba代码与libre office兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 00:02