Utility Software I
lab 10
Jacek Wiślicki, jacenty@kis.p.lodz.pl
BASIC MACROINSTRUCTIONS (MACROS) OO Calc offers a functionality of building complex actions and quasi-programs by means of a special scripting language called OpenOffice.org Basic (OOo Basic), applied in many variants (usually known as Visual Basic or Visual Basic for Applications – VBA) in many common applications (e.g. MS Office, AutoCAD). Macros are available in the same manner in all OpenOffice applications. In order to run macros you will probably need a Java Virtual Machine (JVM). If it is not available in your system, download it (JRE 1.5) and install: http://java.sun.com/j2se/1.5.0/download.jsp. Then configure your JRE in OpenOffice by Tools → Options → OpenOffice.org → Java.
Recording and running a macro You can automate many functions and activities by recording them and running as macros. In order to demonstrate this feature, open OO Calc and enter a few random cell values (e.g. text, numbers, dates) Select Tools → Macros → Record Macro. A small dialog enabling to stop recording opens. Select the range of cells with values you have just entered. Apply some cell formatting (e.g. negative numbers in red, some special date formats, fonts, borders, alignments, colours, etc.). Stop recording and decide where and how to save your macro (in the workbook, in a general library, etc.). Remember its name and location so that you could reuse it. Now remove the formatting from the cell range, you can also change some of the values. Start your macro (Tools → Macros → Run macro) and see if it works.
Macro editor Every macro is stored as a plain-text code. In order to see it, select Tools → Macros → Organize macros → OpenOffice.org Basic, find you macro and press Edit (a macro edition is also available from other places). The editor and a code could look as follows:
By pressing Organizer button you can also create a new empty macro and then start editing its code. page 1 of 7