【发布时间】:2016-03-03 11:40:49
【问题描述】:
我在 LibreOffice BASIC 中有一个宏,我想从我的 python 程序中运行它。我发现了一些他们使用此代码的线程:
import os
import win32com.client
if os.path.exists("excelsheet.xlsm"):
xl=win32com.client.Dispatch("Excel.Application")
xl.Workbooks.Open(Filename="C:\Full Location\To\excelsheet.xlsm", ReadOnly=1)
xl.Application.Run("excelsheet.xlsm!modulename.macroname")
## xl.Application.Save() # if you want to save then uncomment this line and change delete the ", ReadOnly=1" part from the open function.
xl.Application.Quit() # Comment this out if your excel script closes
del xl
但这适用于 windows Excell 程序,我想要 LibreOffice 程序。可以这样做吗?
谢谢:)
【问题讨论】:
标签: python macros libreoffice basic libreoffice-calc