Advanced Word Processing – Record a Simple Macro

Record a simple macro like: change page setup, insert a table with a repeating heading row, insert fields in document header, footer.

A macro is a saved sequence of commands or keystrokes that are stored for later use. The LibreOffice macro language is very flexible, allowing automation of both simple and complex tasks. Macros are especially useful to repeat a task the same way over and over again.


AWPCh3 (213)
AWPCh3 (214)
AWPCh3 (215)
AWPCh3 (216)
AWPCh3 (217)
AWPCh3 (218)
AWPCh3 (219)
AWPCh3 (220)
AWPCh3 (221)
AWPCh3 (222)
AWPCh3 (223)
AWPCh3 (224)
AWPCh3 (225)
AWPCh3 (226)
AWPCh3 (228)
AWPCh3 (229)
AWPCh3 (230)
AWPCh3 (231)
AWPCh3 (232)
AWPCh3 (233)
AWPCh3 (234)
AWPCh3 (235)
Ch3amacro (1)
Ch3amacro (2)
Ch3amacro (3)
Ch3amacro (4)
Ch3amacro (5)
Ch3amacro (6)
Ch3amacro (7)
AWPCh3 (236)


To learn how to record a simple macro, we need to take a simple example. Here we are going to create a macro for inserting fields into a document header.

To record a macro, first of all we have to make sure that macro recording has been enabled for the document. This can be checked by clicking on ‘Tools’ from the main menu bar. From the resulting drop-down, click on ‘Options’. This opens the ‘Options’ dialog box. In this dialog box, under ‘LibreOffice’, we have an option ‘Advanced’. Here we have a checkbox called ‘Enable macro recording (limited)’. This checkbox must be checked in order to be able to record macros in Writer.
17enable macro
After the macro recording has been enabled, go to the page where the field to the header needs to be inserted. Now click on ‘Tools’ from the main menu bar. From the resulting drop-down, click on ‘Macros’ and from the resulting sub-menu, click on ‘Record Macro’. This will open the ‘Record Macro’ dialog box.
18stop recording

In this dialog box, we have a ‘Stop Recording’ button. Once this dialog is open, start working on inserting a field to the page header. Once you are finished, click on ‘Stop Recording’. This will open the ‘LibreOffice Basic Macros’ dialog box.
19save macro
In this dialog box, select the location where you want to save the macro. Here we are going to select the name of the document, which is ‘Untitled1.ods’. Under this name we have the ‘Standard’ library. In this library create a new module by clicking on the ‘New Module’ button. After creating the module, click on the module name and enter a new name for the macro under ‘Macro Name’. After entering the name, click on ‘Save’. This will save the macro.