OpenOffice.org Macro Explained.pdf
(
22635 KB
)
Pobierz
OpenOffice.org Macros Explained
OOME Third Edition
Last Modified
Tuesday, September 6, 2011 at 12:20:33 AM
Document Revision: 420
General Information
The contents of this document is Copyright 2011 by Andrew D. Pitonyak. I will make a final
license decision when I am finished.
I created a second edition that was never released, which is why I refer to this book as the
third edition.
I have been repeatedly asked about the cover page so.... I am neither an artist nor a designer,
so, I hired Amanda Barham (see
http://www.amandabarham.com
)
. She did an awesome job.
Table of Contents
General Information
.
..................................................................................................................1
Table of Contents
........................................................................................................................i
1.
Introduction and housekeeping
.
..........................................................................................11
1.1.
Comments from the author
.
.........................................................................................11
1.2.
OpenOffice.org Bug
.
...................................................................................................11
1.3.
Environment and comments
.
.......................................................................................11
2.
Getting Started
....................................................................................................................12
2.1.
Macro storage
.
.............................................................................................................12
2.1.1.
Library container
.
................................................................................................12
2.1.2.
Libraries
.
..............................................................................................................13
2.1.3.
Modules and dialogs
.
...........................................................................................14
2.1.4.
Key points
.
...........................................................................................................14
2.2.
Creating new modules and libraries
.
...........................................................................14
2.3.
Macro language
.
..........................................................................................................16
2.4.
Create a module in a document
.
..................................................................................16
2.5.
Integrated Debugging Environment
.
...........................................................................19
2.6.
Enter the macro
.
..........................................................................................................22
2.7.
Run a macro
.
...............................................................................................................23
2.8.
Macro security
.
............................................................................................................23
2.9.
Using breakpoints
.
.......................................................................................................26
2.10.
How libraries are stored
.
...........................................................................................26
2.11.
How documents are stored
.
.......................................................................................27
2.12.
Conclusion
.
................................................................................................................28
3.
Language Constructs
.
..........................................................................................................29
3.1.
Compatibility with Visual Basic
.
................................................................................30
3.2.
Compiler options and directives
.
.................................................................................31
3.3.
Variables
.
....................................................................................................................31
3.3.1.
Constant, subroutine, function, label, and variable names
.
.................................31
3.3.2.
Declaring variables
.
.............................................................................................32
3.3.3.
Assigning values to variables
.
.............................................................................34
3.3.4.
Boolean variables are True or False
.
...................................................................34
3.3.5.
Numeric variables
.
...............................................................................................35
Integer variables
.
........................................................................................................36
Long Integer variables
.
..............................................................................................37
Currency variables
.
....................................................................................................37
Single variables
.
.........................................................................................................38
Double variables
.
.......................................................................................................38
3.3.6.
String variables contain text
.
...............................................................................39
3.3.7.
Date variables
.
.....................................................................................................40
3.3.8.
Create your own data types
.
................................................................................41
3.3.9.
Declare variables with special types
.
...................................................................42
i
3.3.10.
Object variables
.
................................................................................................43
3.3.11.
Variant variables
.
...............................................................................................43
3.3.12.
Constants
.
..........................................................................................................44
3.4.
The With statement
.
....................................................................................................45
3.5.
Arrays
.
.........................................................................................................................45
3.5.1.
Changing the dimension of an array
.
...................................................................48
3.5.2.
The unexpected behavior of arrays
.
.....................................................................50
3.6.
Subroutines and functions
.
..........................................................................................52
3.6.1.
Arguments
.
..........................................................................................................53
Pass by reference or by value
.
...................................................................................53
Optional arguments
.
...................................................................................................56
Default argument values
.
...........................................................................................57
3.6.2.
Recursive routines
.
..............................................................................................57
3.7.
Scope of variables, subroutines, and functions
.
..........................................................59
3.7.1.
Local variables defined in a subroutine or function
.
..........................................59
3.7.2.
Variables defined in a module
.
............................................................................59
Global
.
.......................................................................................................................60
Public
.
........................................................................................................................60
Private or Dim
.
...........................................................................................................61
3.8.
Operators
.
....................................................................................................................61
3.8.1.
Mathematical and string operators
.
.....................................................................63
Unary plus (+) and minus ()
.
....................................................................................63
Exponentiation (^)
.
....................................................................................................63
Multiplication (*) and Division (/)
.
...........................................................................64
Remainder after division (MOD)
.
..............................................................................64
Integer division (\)
.
....................................................................................................65
Addition (+), subtraction (), and string concatenation (& and +)
.
............................66
3.8.2.
Logical and bitwise operators
.
...........................................................................66
AND
.
..........................................................................................................................69
OR
.
.............................................................................................................................69
XOR
.
..........................................................................................................................70
EQV
.
..........................................................................................................................70
IMP
.
...........................................................................................................................71
NOT
.
..........................................................................................................................72
3.8.3.
Comparison operators
.
.........................................................................................72
3.9.
Flow control
.
...............................................................................................................73
3.9.1.
Define a label as a jump target
.
...........................................................................73
3.9.2.
GoSub
.
.................................................................................................................73
3.9.3.
GoTo
.
...................................................................................................................74
3.9.4.
On GoTo and On GoSub
.
....................................................................................74
3.9.5.
If Then Else
.
........................................................................................................75
ii
Plik z chomika:
FatumTech
Inne pliki z tego folderu:
OpenOffice.org Macro Explained.pdf
(22635 KB)
Inne foldery tego chomika:
• Książki pomieszane
• Pakiety książek
Akwarystyka
Baśnie i legendy
Ekonomia
Zgłoś jeśli
naruszono regulamin