Calc Guide
If you choose to disable macros, then when the document loads, Calc can no longer
find the function.
Figure 318: The function is gone
When a document is created and saved, it automatically contains a library named
Standard. The Standard library is automatically loaded when the document is
opened. No other library is automatically loaded.
Calc does not contain a function named NumberFive(), so it checks all opened and
visible macro libraries for the function. Libraries in OpenOffice.org Macros, My
Macros, and the Calc document are checked for an appropriately named function
(see Figure 310). The NumberFive() function is stored in the AuthorsCalcMacros
library, which is not automatically loaded when the document is opened.
Use Tools > Macros > Organize Macros > OpenOffice.org Basic to open the
OpenOffice.org Basic Macros dialog (see Figure 319). Expand CalcTestMacros and
find AuthorsCalcMacros. The icon for a loaded library is a different color from the
icon for a library that is not loaded.
Click the expansion symbol (usually a plus or a triangle) next to AuthorsCalcMacros
to load the library. The icon changes color to indicate that the library is now loaded.
Click Close to close the dialog.
Unfortunately, the cells containing =NumberFive() are in error. Calc does not
recalculate cells in error unless you edit them or somehow change them. The usual
solution is to store macros used as functions in the Standard library. If the macro is
large or if there are many macros, a stub with the desired name is stored in the
Standard library. The stub macro loads the library containing the implementation and
then calls the implementation.
1) Use Tools > Macros > Organize Macros > OpenOffice.org Basic to open
the OpenOffice.org Basic Macros dialog. Select the NumberFive macro and
click Edit to open the macro for editing.
Figure 319: Select a macro and click Edit
Chapter 12 Calc Macros 307