Running a macro with COM

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Roalf
Posts: 2
Joined: Mon Aug 30, 2010 1:01 pm

Running a macro with COM

Post by Roalf »

Hallo,

i want to run a OO-Macro from a external Programm (LotusScript, similar to VBA). And i use the COM-Interface.

i Try with:
set dispatcher = createObject("com.sun.star.frame.DispatchHelper")
call dispatcher.executeDispatch(document, ".uno:RunMacro", "macroname", 0, Array())

but this doesn't work.

It's something wrong or exisis another way to run a macro?


Roalf
Last edited by Roalf on Mon Aug 30, 2010 2:55 pm, edited 1 time in total.
OpenOffice 3.1.1 on Windows 7 / Lotus Notes 8.5.1
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Running a macro with COM

Post by B Marcelly »

Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Roalf
Posts: 2
Joined: Mon Aug 30, 2010 1:01 pm

Re: Running a macro with COM

Post by Roalf »

Hello Berndard,
thanx for your Help, but i now the base technic about the COM UNO bridge as well. I've written some well running code to automate OO from Lotus. But now i have a particular problem. I have to start a macro und i don't now how in have to do this with the COM UNO bridge. (in OO-Basic its a simple "call macro").
If have try to found this in the OO-documentation but, these documentation overextended me a little bit in this case.

Roalf
OpenOffice 3.1.1 on Windows 7 / Lotus Notes 8.5.1
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Running a macro with COM

Post by B Marcelly »

Hi,
Roalf wrote: i now the base technic about the COM UNO bridge as well. I've written some well running code to automate OO from Lotus.
It did not sound like that from your code.
You may download the VBx OOo tool for VBA and read the documents. You will find routines for calling macros. Do the equivalent in your language.
If your program loads a document containing macros, you have to load it with the option MacroExecutionMode set to a correct value.

It is preferable in my opinion to avoid calling a macro if you can do the equivalent through COM.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
Post Reply