Macro no longer launching from the command line

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
&apos;	msgbox &quot;Hello!&quot;
&apos;	msgbox &quot;Template file is &quot;+sTemp
&apos;	msgbox &quot;Data source is &quot;+sSource
&apos;	msgbox &quot;Destination is &quot;+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 = &quot;Hidden&quot;
	loadArgs(0).value = True
	loadArgs(1).name = &quot;ReadOnly&quot;
	loadArgs(1).value = False
	
	oTempDoc = starDesktop.loadComponentFromURL(convertToURL(sTemp), &quot;_blank&quot;, 0, loadArgs())
	oSourceDoc = starDesktop.loadComponentFromURL(convertToURL(sSource), &quot;_blank&quot;, 0, loadArgs())
	
	oCopyRange = oSourceDoc.sheets(0).getCellRangebyName(&quot;A33:K2912&quot;)
	oContents = oCopyRange.getDataArray()
	oPasteRange = oTempDoc.sheets(0).getCellRangebyName(&quot;A33:K2912&quot;)
	oPasteRange.setDataArray(oContents)
	
	oDiagram = oTempDoc.sheets(0).charts(0).getEmbeddedObject().getDiagram()
	oDiagram.XAxis.Max = int(oTempDoc.sheets(0).getCellRangebyName(&quot;L33&quot;).value + 1.5) + 1.0/24
	oDiagram.XAxis.Min = int(oTempDoc.sheets(0).getCellRangebyName(&quot;L33&quot;).value + 0.5) - 1.0/24	
	
	oTempDoc.storeAsUrl(convertToURL(sDest), array())
	
	If HasUnoInterfaces(oSourceDoc, &quot;com.sun.star.util.XCloseable&quot;) Then
		oSourceDoc.close(true)
	Else
		oSourceDoc.dispose()
	End If
	
	If HasUnoInterfaces(oTempDoc, &quot;com.sun.star.util.XCloseable&quot;) Then
		oTempDoc.close(true)
	Else
		oTempDoc.dispose()
	End If
	
End Sub


</script:module>

I don’t think that would work. Specifically, the occurrences of ‘&quot’ 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?

As you wrote you updated recently my first suspect would be increased macro-security, wich may prevent the use of macros in locations not registered as safe.
But: Wich Version before and now??

Thanks! I went from 7.0.6.2 to 7.3.6, so that could be the case. Is there a browsable place where LO stores libraries and modules that are not part of an LO file? I don’t think what I found is the latest version of my macro, because LO 4 was a really long time ago, and the version I found does not work. I tried copying what’s in that *.xba file to a new module, replacing occurrances of &quot; with double quotes and occurrances of &apos; with single quotes. (If I don’t escape them, that’s how this forum platform intreprets them.) That leaves me with

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

If I try running that, it fails because it cannot detect the file type of the template file, so to rectify that, I had to expand loadArgs to length 2 and add

	loadArgs(2).name = "FilterName"
	loadArgs(2).value = "calc8"

That gets me past the line

	oTempDoc = starDesktop.loadComponentFromURL(convertToURL(sTemp), "_blank", 0, loadArgs())

But now the line

	oCopyRange = oSourceDoc.sheets(0).getCellRangebyName("A33:K2912")

Throws an error message

BASIC runtime error.
Object variable not set.

Which makes no sense to me. What object variable is not set? I think sheets and getCellRangebyName are both methods, which only leaves oSourceDoc. That was set in the last non-blank preceding line, which is not throwing any errors.

I have no preference whether I end up finding the most recent version of this macro (which I suspect is gone forever, since I uninstalled LO) or get this old one to work. This python script/LO macro combination is one I use every weekday, clumsy and fragile as it is.

For some reason, the line

	oSourceDoc = starDesktop.loadComponentFromURL(convertToURL(sSource), "_blank", 0, loadArgs())

is not setting the object variable oSourceDoc. I can’t even call oSourceDoc.dbg_Properties without getting the same error message. So, why isn’t that line working, and why isn’t it throwing an error message when it doesn’t work?

Got it working. I had to create two different loadArgs arrays, one with and one without the filtername included. The oTempDoc line needed the filtername given to it, and the oSourceDoc line needed to not be given the filtername. I have no idea why.