How to Write Macros in an OpenOffice Database

Written by jackie lohrey
  • Share
  • Tweet
  • Share
  • Email

Macro support in an OpenOffice database is a feature that provides options for automating common functions and increases ways to customise the application by writing reusable pieces of code you can insert in your database and run at any time. OpenOffice Base, the database program included with the free suite of OpenOffice desktop productivity programs, can assist you in creating both simple and complex macros. Because there is a significant learning curve associated with writing macros in an OpenOffice database, getting started by using a built-in macro recorder provides a good base for further learning.

Skill level:

Other People Are Reading


  1. 1

    Select a task you want the macro to perform. While the task you select can consist of one or many steps, selecting a simple task, such as adding personal information to a database form, is a good place to start.

  2. 2

    Open the OpenOffice Base database to the object, such as a form, where you want to record the macro. Select the "Tools" tab on the Base main menu. Select "Macros" and "Record Macro" to open a small dialogue box set to "Record Macro" by default. Type the information you want to record into the appropriate fields on the form. For example, if you routinely fill out forms where you must enter your name, title, employee number and office phone number in a standard fashion, type this information in the appropriate fields as normal and select "Stop Recording." OpenOffice Base temporarily saves the new macro on a clipboard.

  3. 3

    Create a container, or module, for the new macro by selecting "Tools" on the Base main menu, then "Macros" and "Organize Macros." Select the "My Macros" library container and then "Standard" library. Click "New Module" to open the "New Module" window. Type in a name for the module, such as "AddName" and click "OK" to create the new macro module, add it to the Standard Library list, and close the "New Module" window.

  4. 4

    Save the macro in the module you created by first selecting the "AddName" module. Then type in a name for the macro, such as "PersonalInfo," in the text box that appears in the upper left corner of the screen. Press the "Save" button to save the macro.

  5. 5

    Run the macro by placing your cursor in the first text box where you want to enter information. Select "Tools," "Macros" and "Run Macros" to open a "Macro Selector" box. Select your macro from the list and press the "Run" button to complete entering information in the appropriate fields.

Tips and warnings

  • The clipboard feature in OpenOffice Base will retain information for one macro at a time. If you record a macro and forget to save it, the information is lost when you attempt to create another macro. It is a good idea to record and then immediately save your macro to prevent accidental erasure.
  • You can place more than one macro in a module container as long as each macro has a unique name. For example, if you work on the database with another individual, you can both record "name" macros, and save them to the "AddName" module.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.