Operation Manual

Figure 339: Macro Library hierarchy
If a macro is contained in a document, then a recorded macro will attempt to work on that
document; because it primarily uses “ThisComponent” for its actions.
Every library container contains a library named Standard. It is better to create your own libraries
with meaningful names than to use the Standard library. Not only are meaningful names easier to
manage, but they can also be imported into other library containers whereas the Standard library
cannot.
Caution
LibreOffice allows you to import libraries into a library container, but it will not allow
you to overwrite the library named Standard. Therefore, if you store your macros in
the Standard library, you cannot import them into another library container.
Just as it makes good sense to give your libraries meaningful names, it is prudent to use
meaningful names for your modules. By default, LibreOffice uses names such as Module1,
Module2 and so on.
As you create your macros, you must decide where to store them. Storing a macro in a document
is useful if the document will be shared and you want the macro to be included with the document.
Macros stored in the application library container named My Macros, however, are globally
available to all documents.
Macros are not available until the library that contains them is loaded. The Standard library and
Template library, however, are automatically loaded. A loaded library is displayed differently from a
library that is not loaded. To load the library and the modules it contains, double-click on the library.
Where are macros stored?
LibreOffice stores user-specific data in a directory in the home directory for each user. The location
is operating system specific. Go to Tools > Options > LibreOffice > Paths on the main menu bar
to view where other configuration data are stored. For example, on computer running Windows XP,
this is C:\Documents and Settings\<user name>\Application Data. User macros are
stored in LibreOffice\4\user\basic. Each library is stored in its own directory off the basic
directory.
Chapter 13 Getting Started with Macros | 347