Listing 2: Contents of Module1 after it is created.
REM ***** BASIC *****
Sub Main
End Sub
Add the new macro either before Sub Main or after End Sub. In Listing 3, the new
macro has been added before Sub Main.
Listing 3: Module1 after adding the new macro.
REM ***** BASIC *****
Sub HelloMacro
Print "Hello"
End Sub
Sub Main
End Sub
Click on the Run Basic button in the toolbar to run the first macro in the module.
Use the Macro dialog, opened using the Select macro button or Tools > Macros
> Organize Macros > OpenOffice.org Basic, to select and run any macro in the
module.
Creating a simple macro
Imagine repeatedly entering simple information. Although you can store the
information in the clipboard, if you use the clipboard for something else, the contents
are changed. Storing the contents as a macro is a simple solution. (In some simple
cases, including the example used here, a better solution is to use AutoText.)
1) Use Tools > Macros > Record Macro to start recording a macro.
A small window is displayed so you know that OpenOffice.org is
recording.
2) Type the desired information or perform an appropriate series
of operations. In this case, I typed my name, Andrew Pitonyak.
3) Click the Stop Recording button to stop recording, save the macro, and
display the OpenOffice.org Basic Macros dialog.
324 Getting Started with OpenOffice.org 3.3
Comentarios a estos manuales