Close LibreOffice

I believe there was request submission ages ago to develop a way of closing LO via a macro at the end of a programme. Did anything happen or is there a simple way to do it?

Simple ways to find things give

This always worked. Just terminate the office desktop.

It would be nice to find out how to do that with a macro. Using Andrew’s code, I get this message

BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.DisposedException
Message: .

@nigelb1,
Just to say you use some type of code does not help. Always post the code you are using and not some vague reference please.

For me I have always used the command in a menu of uno:Quit. In a macro (won’t close Basic IDE) it is:

	dim document as object
	dim dispatcher as object
	document = ThisComponent.CurrentController.Frame
	dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	dispatcher.executeDispatch(document, ".uno:Quit", "", 0, Array())

.
However, StarDesktop.Terminate() works the same.