Operation Manual
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.
For casual use, it is not necessary to understand where macros are stored. If you know where they
are stored, however, you can create a backup, share your macros, or inspect them if there is an
error.
Go to Tools > Macros > Organize Dialogs on the main menu bar to open the LibreOffice Macro
Organizer dialog (Figure 341 on page 352). Alternatively, go to Tools > Macros > Organize
Macros > LibreOffice Basic on the main menu bar to open the LibreOffice Macros dialog (Figure
340 on page 352) and then click the Organizer button.
Importing macros
The LibreOffice Macro Organizer dialog allows you to import macro libraries into your document as
well as creating, deleting, and renaming libraries, modules, and dialogs.
1) Select the library container to use and then click Import to import macro libraries (Figure
341 on page 352).
2) Navigate to the directory containing the library to import (Figure 346). There are usually two
files from which to choose, dialog.xlb and script.xlb. It does not matter which of these two
files you select; both will be imported. Macros can be stored in libraries inside LibreOffice
documents. Select a document rather than a directory on disk to import libraries contained
in a document.
Note
You cannot import the library named Standard.
Tip
On a computer operating Linux, the LibreOffice specific files are stored in the home
directory of a user, in a subdirectory whose name begins with a period (usually .config/).
Directories and files with names beginning with a period may be hidden and not shown
in a normal selection dialog. If using LibreOffice dialogs, rather than the operating
system specific dialogs, type the name of the desired directory in the Name field.
Chapter 13 Getting Started with Macros | 363










