我在LibreOffice BASIC中有一個宏,我想從我的python程序運行它。我發現一些線程中,他們使用此代碼:從python運行Libreoffice BASIC宏
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的程序。是否有可能做到這一點?
謝謝:)