OpenOffice.org OpenOffice - 3.0 Quick Start Guide Page 377

  • Download
  • Add to my manuals
  • Print
  • Page
    / 433
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 376
Cursor movements are used for all operations (as opposed to
searching). If run on the DONTKNOW line, the word
weight
is moved
to the front of the line, and the first “The” is changed to “She”. This is
not perfect, but I should not have run the macro on the lines that did
not have the proper format; I need to do these manually.
Running the macro quickly
It is tedious to repeatedly run the macro using Tools > Macros > Run
Macro (see Figure 316). The macro can be run from the IDE. Use
Tools > Macros > Organize Macros > OpenOffice.org Basic to
open the Basic Macro dialog. Select your macro and click Edit to open
the macro in the IDE.
The IDE has a Run Basic icon in the toolbar that runs the first macro
in the IDE. Unless you change the first macro, it is the empty macro
named Main. Modify Main so that it reads as shown in Listing 3.
Listing 3: Modify Main to call CopyNumToCol1.
Sub Main
CopyNumToCol1
End Sub
Now, you can run CopyNumToCol1 by repeatedly clicking the Run
Basic icon in the toolbar of the IDE. This is very fast and easy,
especially for temporary macros that will be used a few times and then
discarded.
Sometimes the macro recorder fails
Understanding the OpenOffice.org internals helps to understand how
and why the macro recorder frequently fails. The primary offender is
related to the dispatch framework and its relationship to the macro
recorder.
The dispatch framework
The purpose of the dispatch framework is to provide a uniform access
to components (documents) for commands that usually correspond to
menu items. I can use File > Save from the menu, the shortcut keys
Ctrl+S
, or click on the Save toolbar icon. All of these commands are
translated into the same “dispatch command”, which is sent to the
current document.
Chapter 13 Getting Started with Macros 377
Page view 376
1 2 ... 372 373 374 375 376 377 378 379 380 381 382 ... 432 433

Comments to this Manuals

No comments