[Solved] Call a macro in a specific module

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
devas
Posts: 2
Joined: Wed Oct 21, 2015 3:20 am

[Solved] Call a macro in a specific module

Post by devas »

Hello Everyone,

I am not sure if a similar query has been posted before. However, I couldn't find posts that are related to my issue.

I am trying to execute an OpenOffice macro from command line under a specific ODS module but unsuccessful (command as shown below).

"D:\Program Files (x86)\OpenOffice 4\program\soffice" -invisible -norestore -nologo -nolockcheck -headless "macro:///[extract_of.ods].Standard.Module1.Load_Target (parameter1)"

It works when the macro is copied over to MyMacros (as below).

"D:\Program Files (x86)\OpenOffice 4\program\soffice" -invisible -norestore -nologo -nolockcheck -headless "macro:///Standard.Module1.Load_Target (parameter1)"

However the requirement is for everyone, with access to the server, to be able to execute the macro which is not possible if the macros are under a specific user's modules (unless there is a way to grant permissions).

Please help me resolving this issue. Thank you.
Last edited by Hagar Delest on Thu Oct 29, 2015 12:40 am, edited 1 time in total.
Reason: tagged [Solved].
Open Office 4.1.1
FJCC
Moderator
Posts: 9549
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Call a macro in a specific module

Post by FJCC »

I can execute a macro called printSub stored in a Calc document in a library called NewLib, in a module called NewMod from the command line like this

Code: Select all

"C:\Program Files (x86)\OpenOffice 4\program\soffice" "c:\users\fjcc\desktop\Test.ods" "macro://Test/NewLib.NewMod.printSub(String to be printed)"
"String to be printed" is a parameter passed to the sub routine. Does something like that work for you?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
devas
Posts: 2
Joined: Wed Oct 21, 2015 3:20 am

Re: Call a macro in a specific module

Post by devas »

Thank you.

I have managed to resolve this by manually setting up the libraries. The steps I have followed:

a. edited .xlc files under basic folder to include my Library (ex: Targets).
b. created the library folder (Targets) under basic and added .xlb and .xla files

Finally able to call macro using:

"D:\Program Files (x86)\OpenOffice 4\program\soffice" -invisible -norestore -nologo -nolockcheck -headless "macro:///Targets.ExtractTargets.Extract_Target (parameter1)"

where Targets -> library folder name
ExtractTargets -> .xba configuration file name
Extract_Target -> Macro

Thanks.
Open Office 4.1.1
Post Reply