I have a python script that uses subprocess.call to basically call libreoffice from the command line with a parameter to run a macro (with parameters for the macro). It was working as desired for years, until recently, I installed the latest version of LO and, finding it unworkable, rolled back to my previous version by unstalling LO and reinstalling the previous version. Now, it isn’t throwing any error messages, but it does not appear to be running the macro at all. The call is
C:\Program Files/LibreOffice/program/soffice.exe, 'macro:///DataLog.Module1.Log([Parameters for macro]))
When I went to troubleshoot the macro, I couldn’t seem to find it. Is it possible that when I uninstalled LO it was wiped out, or where should I be looking for it?
Edit: I think I just found it intact, so it was not wiped out. LibreOffice is just failing to find it. It’s at
C:\Users\Aaron\AppData\Roaming\LibreOffice\4\user\basic\DataLog\Module1.xba
Note: the backslashes are because I’m in Windows.
Can I make LO recognize it’s there?
Edit2: I was going to use the “Import” function on the organizer dialog, but *.xba is not on the list of recognized formats. Then, I was going to re-create it by copying and pasting from it, but the contents were:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic" script:moduleType="normal">REM ***** BASIC *****
option Explicit
Sub Log(sTemp as string, sSource as string, sDest as string)
dim loadArgs(1) as new com.sun.star.beans.PropertyValue
' msgbox "Hello!"
' msgbox "Template file is "+sTemp
' msgbox "Data source is "+sSource
' msgbox "Destination is "+sDest
dim oTempDoc as object
dim oSourceDoc as object
dim oCopyRange as object
dim oPasteRange as object
dim oContents(60000,11) as object
dim oDiagram as object
loadArgs(0).name = "Hidden"
loadArgs(0).value = True
loadArgs(1).name = "ReadOnly"
loadArgs(1).value = False
oTempDoc = starDesktop.loadComponentFromURL(convertToURL(sTemp), "_blank", 0, loadArgs())
oSourceDoc = starDesktop.loadComponentFromURL(convertToURL(sSource), "_blank", 0, loadArgs())
oCopyRange = oSourceDoc.sheets(0).getCellRangebyName("A33:K2912")
oContents = oCopyRange.getDataArray()
oPasteRange = oTempDoc.sheets(0).getCellRangebyName("A33:K2912")
oPasteRange.setDataArray(oContents)
oDiagram = oTempDoc.sheets(0).charts(0).getEmbeddedObject().getDiagram()
oDiagram.XAxis.Max = int(oTempDoc.sheets(0).getCellRangebyName("L33").value + 1.5) + 1.0/24
oDiagram.XAxis.Min = int(oTempDoc.sheets(0).getCellRangebyName("L33").value + 0.5) - 1.0/24
oTempDoc.storeAsUrl(convertToURL(sDest), array())
If HasUnoInterfaces(oSourceDoc, "com.sun.star.util.XCloseable") Then
oSourceDoc.close(true)
Else
oSourceDoc.dispose()
End If
If HasUnoInterfaces(oTempDoc, "com.sun.star.util.XCloseable") Then
oTempDoc.close(true)
Else
oTempDoc.dispose()
End If
End Sub
</script:module>
I don’t think that would work. Specifically, the occurrences of ‘"’ might not be interpreted correctly. I don’t know whether those should be single or double.
Any ideas on how I can get this module back to an operational and recognized state?