Can I run the openoffice macro from an external file?

I want to run the OpenOffice macro from an external file. How:

vlad@leo ~ $ soffice macro:///home/vlad/q.vbs 
+4
source share
1 answer

Not quite an answer - just a comment instead to answer this question and hopefully get an answer :)

Perhaps this is due to the need to explicitly set permissions for macros, for example:

Cannot execute macro from command line (Show topic) • OpenOffice.org community forum

Edit: It actually seems impossible to invoke document macros, which is ideal for security reasons.

See also:

As a side note, the standard Module1 file can be found in (on Linux):

 ~/.openoffice.org/3/user/basic/Standard/Module1.xba ~/.libreoffice/3/user/basic/Standard/Module1.xba 

and note that .xba is actually an XML file that contains the main source of macros, as in:

 <?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">REM ***** BASIC ***** Sub Main End Sub</script:module> 

Unfortunately, just copying to the appropriate directories (below, in extensions) does not work, as in the following command line fragment.

 sudo mkdir /usr/lib/libreoffice/share/extensions/mytest sudo cp ~/.libreoffice/3/user/basic/Standard/Module1.xba /usr/lib/libreoffice/share/extensions/mytest/MyTestModule.xba sudo sed -i 's/Module1/MyTestModule/g' /usr/lib/libreoffice/share/extensions/mytest/MyTestModule.xba 

So, I assume that the only way is to manually add / enable macros in OpenOffice, and then maybe find where the corresponding .xba is stored and change their code there (if you only need to use the command line) ...

You can use Python - the OpenOffice.org Wiki is a more open approach to external scripts - but it requires you to start openoffice as a server ..

+4
source

All Articles