OpenOffice.org/Macro: Difference between revisions
Appearance
[checked revision] | [checked revision] |
Content deleted Content added
en.wb doesn't remove iw's when the info is also at wd (though in this case there may be discrepancies that should be investigated carefully) |
mv'd |
||
Line 47: | Line 47: | ||
{{BookCat}} |
{{BookCat}} |
||
[[fr:OpenOffice |
[[fr:OpenOffice/Calc/Macros]] |
||
[[pt:OpenOffice.org/Macro]] |
[[pt:OpenOffice.org/Macro]] |
Revision as of 22:00, 16 February 2021
If you want to perform a repetitive task, doing this automatically using a macro is the way to go. A macro is a series of instructions for the computer to perform. Macros are widely used by professionals and expert users in Microsoft Office. OpenOffice.org can also perform macros. OpenOffice.org can be scripted through OpenOffice.org Basic (the easiest and most common language), Python, Beanshell, and Javascript, this feature is more widely known as Macro.
Imagine you have twelve spreadsheets which need your name as a page footer, the top row made bold and the fourth column highlighting in red. How would you do this without going through each one individually? The answer is record a macro. |
A simple macro called Main to zoom out to 75% in OpenOffice.org Basic looks like this.
sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = 75
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, args1())
end sub
External links
- Getting Started with Macros - OpenOffice.org Wiki
- OpenOffice.org BASIC Programming Guide - OpenOffice.org Wiki
- OpenOffice.org Macros Explained
- Linux.com :: Getting started with OpenOffice.org macros
General Macro help
- Record and use Excel macros - Excel - Microsoft Office Online
- Hands On: Make your first macro - Computeractive
- Create macros for Office applications - 12 May 2008 - Computeractive
- Short and sweet: Using macros in Word and Excel - 03 Nov 2004 - Computeractive
- Macros made easy - 21 Feb 2003 - Computeractive
![]() |
A reader has identified this chapter as an undeveloped draft or outline. You can help to develop the work, or you can ask for assistance in the project room. |