[Solved] How to Terminate Office from a Macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
aussiedaddy
Posts: 2
Joined: Fri Sep 19, 2008 2:19 pm

[Solved] How to Terminate Office from a Macro

Post by aussiedaddy »

I need to write a macro that will run and then terminate Office. The rest of the macro I can get working but not the termination bit. I gather that terminate() is the required method and that it is provided by the com.sun.star.frame.XDesktop interface. I tried the following:

desktop = createUnoService("com.sun.star.frame.XDesktop")
desktop.terminate()

Can anyone out there help? I am obviously doing something wrong.

The error message I get is:

BASIC runtime error.
Object variable not set.
Last edited by Hagar Delest on Fri Sep 19, 2008 5:16 pm, edited 1 time in total.
Reason: tagged the thread as Solved.
OOo 2.3.X on Ubuntu 8.x
aussiedaddy
Posts: 2
Joined: Fri Sep 19, 2008 2:19 pm

Re: How to Terminate Office from a Macro (Solved I think)

Post by aussiedaddy »

Hi all

Having struggled for quite a while with this before posting the above I came across some information on StarDesktop and

StarDesktop.terminate()

seems to be the solution.
OOo 2.3.X on Ubuntu 8.x
Post Reply