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

Keyboard macros or custom scripts

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

Postby onidarbe » Sun May 24, 2009 12:35 pm

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?
Attachments
macro run command.JPG
Last edited by onidarbe on Sun May 24, 2009 10:24 pm, edited 1 time in total.
OOo 3.1.X on Ms Windows XP
User avatar
onidarbe
 
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

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

Postby B Marcelly » Sun May 24, 2009 10:12 pm

Hi,
Code: Select all   Expand viewCollapse view
soffice.exe "C:\My Documents\MyFile.ODS" "macro://MyFile/Standard.Module1.sMySub"

And avoid using spaces and national characters in the file name.
______
Bernard
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

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

Postby onidarbe » Sun May 24, 2009 10:24 pm

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 ;-)
OOo 3.1.X on Ms Windows XP
User avatar
onidarbe
 
Posts: 84
Joined: Thu Nov 29, 2007 8:03 pm
Location: Belgium, Mechelen

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

Postby abhiabhi_84 » Sat Aug 15, 2009 12:04 pm

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
OOo 2.3.X on Ms Windows XP
abhiabhi_84
 
Posts: 46
Joined: Wed Nov 19, 2008 7:54 pm

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

Postby antekg » Mon Dec 04, 2017 5:36 pm

Code: Select all   Expand viewCollapse view
"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.
AOO 4.1.4 (Polish) on Windows 10 (64b) / AOO 4.1.0 on Windows Vista / (LibreOffice on Mageia Linux)
User avatar
antekg
 
Posts: 14
Joined: Sat Oct 17, 2009 10:03 pm


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest