Page 1 of 1

[Solved] Can't execute macro in file.ods from command line

Posted: Sun May 24, 2009 12:35 pm
by onidarbe
In my Calc-file I have the basic macro:
Sub sMySub
msgbox "hello"
End Sub

I tried following lines in the XP - command window while in the map "C:\Program Files\OpenOffice.org 3\program>"

soffice.exe "macro:///Standard.Module1.sMySub"
soffice.exe "macro:///[My File.ods].Standard.Module1.sMySub"
soffice.exe "C:\My Documents\My File.ODS" "macro:///Standard.Module1.sMySub"
soffice.exe "C:\My Documents\My File.ODS" "macro:///[My File.ods].Standard.Module1.sMySub"
soffice.exe "C:\My Documents\My File.ODS" "macro:///My File.ods.Standard.Module1.sMySub"

Nothing works except switching the active window to my already running "My File.ods" with the last 3 examples above...

What am I doing wrong?

Re: Can't execute oobasic-macro in file.ods from command line

Posted: Sun May 24, 2009 10:12 pm
by B Marcelly
Hi,

Code: Select all

soffice.exe "C:\My Documents\MyFile.ODS" "macro://MyFile/Standard.Module1.sMySub"
And avoid using spaces and national characters in the file name.
______
Bernard

Re: Can't execute oobasic-macro in file.ods from command line

Posted: Sun May 24, 2009 10:24 pm
by onidarbe
Thank you B Marcelly, I've spend hours looking for this and it's so obvious :knock:

It even works with spaces in the name ;-)

Re: [Solved] Can't execute macro in file.ods from command line

Posted: Sat Aug 15, 2009 12:04 pm
by abhiabhi_84
Hi,

Is it then possible to run a OO macro within a file "test123.ods", without opening the file? or even without getting a message for "ENABLE MACROS"?

I could run a macro through command line, but i dont want calc file to open.

Any way o do it?

Abhi

Re: [Solved] Can't execute macro in file.ods from command li

Posted: Mon Dec 04, 2017 5:36 pm
by antekg

Code: Select all

"c:\Program Files (x86)\OpenOffice 4\program\soffice.exe" -invisible "macro:///Standard.Module1.Main"
No document file is specified and opened. However, the macro must reside in "My macros" container.