Organizing Libraries and Modules

Basic Libraries Containers

LibreOffice Basic libraries can be stored in 3 different containers:

To access macros stored in libraries of LibreOffice Macros or My Macros from another container, including the document container, use the GlobalScope specifier.

Organising Libraries

Creating a New Library

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Libraries tab.

  3. Select to where you want to attach the library in the Location list. If you select LibreOffice Macros & Dialogs, the library will belong to the LibreOffice application and will be available for all documents. If you select a document the library will be attached to this document and only available from there.

  4. Click New and insert a name to create a new library.

Import a Library

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Libraries tab.

  3. Select to where you want to append the library in the Location list. If you select LibreOffice Macros & Dialogs, the library will belong to the LibreOffice application and will be available for all documents. If you select a document the library will be appended to this document and only available from there.

  4. Click Append and select an external library to append.

  5. Select all libraries to be appended in the Append Libraries dialogue. The dialogue displays all libraries that are contained in the selected file.

  6. If you want to insert the library as a reference only check the Insert as reference (read-only) box. Read-only libraries are fully functional but cannot be modified in the Basic IDE.

  7. Check the Replace existing libraries box if you want existing libraries of the same name to be overwritten.

  8. Click OK to append the library.

Export a Library

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Libraries tab.

  3. In the Location list you specify where your library is stored. Select the library that you want to export. Note that you cannot export the Standard library.

  4. Click Export...

  5. Choose whether you want to export the library as an extension or as a basic library.

  6. Click Remove.

  7. Select where you want your library exported.

  8. Click OK to append the library.

Deleting a Library

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Libraries tab.

  3. Select the library to be deleted from the list.

  4. Click Delete.

Organising Modules and Dialogues

Creating a New Module or Dialogue

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Modules tab or the Dialogs tab.

  3. Select the library where the module will be inserted and click New.

  4. Enter a name for the module or the dialogue and click OK.

Renaming a Module or Dialogue

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the module to be renamed twice, with a pause between the clicks. Enter the new name.

    In the Basic IDE, right-click the name of the module or dialogue in the tabs at the bottom of the screen, choose Rename and type in the new name.

  3. Press Enter to confirm your changes.

Deleting a Module or Dialogue

  1. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  2. Click the Modules tab or the Dialogs tab.

  3. Select the module or dialogue to be deleted from the list. Double-click an entry to reveal sub-entries, if required.

  4. Click Delete.

warning

Deleting a module permanently deletes all existing procedures and functions in that module.


Organising Projects among Documents or Templates

Moving or copying modules between documents, templates and the application.

  1. Open all documents or templates among which you want to move or copy the modules or dialogues.

  2. Choose Tools - Macros - Organize Macros - LibreOffice Basic and click Organizer or click the Select Module icon in the Basic IDE to open the Macro Organizer dialogue.

  3. To move a module or dialogue to another document, click the corresponding object in the list and drag it to the desired position. A horizontal line indicates the target position of the current object while dragging. Hold the key while dragging to copy the object instead of moving it.

Please support us!