22.01.2015 Views

OpenOffice.org Macros Explained - LibreOffice-NA.US

OpenOffice.org Macros Explained - LibreOffice-NA.US

OpenOffice.org Macros Explained - LibreOffice-NA.US

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Use to open the Objects catalog (see Figure 12), select a macro and double-click on the macro to edit<br />

that macro.<br />

2.6. Enter the macro<br />

Figure 12. Objects catalog.<br />

Change the text in the IDE to read as shown in Listing 1. Click the run icon.<br />

Listing 1. Hello World macro<br />

REM ***** BASIC *****<br />

Option Explicit<br />

Sub Main<br />

Print "Hello World"<br />

End Sub<br />

Table 2. Line by line description of Listing 1.<br />

Line<br />

REM ***** BASIC *****<br />

Option Explicit<br />

Sub Main<br />

Print "Hello World"<br />

End Sub<br />

Description<br />

Basic comment, this line is ignored. A comment may also begin with a single quote<br />

character.<br />

Tells the basic interpreter that it is an error to use a variable that is not explicitly<br />

defined. Misspelled variables are likely to be caught as an error at compile time.<br />

Indicates that this is the beginning of the definition of a subroutine named Main.<br />

The Print command.<br />

End the Main subroutine.<br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!