Chapter 5 Notes
Unit 2 Electronic Spreadsheet · Chapter 5
Using Macros in Spreadsheets
Master task automation in LibreOffice Calc: Macro Recording, Built-in Recorder Limitations, 4 Macro Security Levels, Standard Library Organization, and Authoring Custom Functions in LibreOffice BASIC.
Chapter 5 Theory
1. What is a Macro & Recording Steps
A macro is a saved sequence of commands or keystrokes stored for repeated execution to automate repetitive tasks.
- Enable recording: Tools > Options > LibreOffice > Advanced > Check 'Enable macro recording'.
- Start recording: Tools > Macros > Record Macro.
- Execute spreadsheet actions (e.g., formatting titles, applying formulas).
- Click Stop Recording on the floating bar.
- Save under My Macros > Standard > Module1.
⚠️ Recorder Limitations: Cannot record mouse selections in the spreadsheet grid, opening non-macro windows, or window repositioning.
2. Macro Security Levels (Tools > Options > Security)
Very High:Only macros from trusted paths execute. All other macros disabled silently.
High:Only signed macros from trusted certificates or locations run.
Medium (Recommended):Prompts user for confirmation before executing macros from untrusted origins.
Low:All macros execute without confirmation warnings.
3. Writing a Custom Function in LibreOffice BASIC
Function SquareNumber(n As Double) As Double
REM Computes square of a number
SquareNumber = n * n
End Function
REM Computes square of a number
SquareNumber = n * n
End Function
In any cell, type =SQUARENUMBER(A1). If A1 is 5, cell returns 25.
Chapter 5 Practice
Solved MCQs: Macros in Spreadsheets
1
What scripting language is primarily used to program and record macros in LibreOffice Calc?
2
Which of the following actions CANNOT be captured by the built-in Macro Recorder in LibreOffice Calc?
3
Which Macro Security level prompts the user for confirmation before executing unsigned macros from untrusted origins?
4
Where are user macros saved by default in LibreOffice so they are accessible across all spreadsheet files?
5
How do you define a custom function in LibreOffice BASIC that can be invoked like a formula in Calc cells?
Frequently Asked Board Questions