Document Event-Driven Macros

This section describes how to assign scripts to application, document or form events.

You can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of document events and at what point an assigned macro is executed.

Event

An assigned macro is executed...

routine

Start Application

...after a LibreOffice application is started.

OnStartApp

Close Application

...before a LibreOffice application is terminated.

OnCloseApp

Document created

...New document created with File - New or with the New icon. Note that this event also fires when Basic IDE opens.

OnCreate

New Document

...after a new document is created with File - New or with the New icon.

OnNew

Document loading finished

...before a document is opened with File - Open or with the Open icon.

OnLoadFinished

Open Document

...after a document is opened with File - Open or with the Open icon.

OnLoad

Document is going to be closed

...before a document is closed.

OnPrepareUnload

Document closed

...after a document was closed. Note that the "Save Document" event may also occur when the document is saved before closing.

OnUnload

-no UI-

OnLayoutFinished