In the description from my link above:
You can start a macro of a specific document at its opening from a command line:
soffice path/to/test.odt macro://./standard.module1.mymacro
So the syntax for the macro URL was: macro://
+ ./
(for specifying that the source is current document) + library_name.module_name.macro_name
.
You never tried to use the mentioned ./
; in the case when you tried to use the file name in the macro URL (your #1), you didn’t separate it from the rest using /
, and you didn’t look at the next sample in the description, that shown that the file name is used without the extension. Additionally, you used that Modules.
part, which is neither library name, nor module name.
The correct command would look like
soffice sample.xlsm macro://./VBAProject.DataModule.WriteCSVFile
However, note that to close the document after the macro, the macro needs to run some code itself. Also dialogs will be shown.
To allow headless operation, your document must be trusted, or the macro security level must be low (to avoid confirmation dialog); also your code must not show dialogs itself.