Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

OpenOffice Calc 3.x Guide
Previous Page Home Next Page

Calc can call macros as Calc functions. Use the following steps to create a simple macro:

  1. Create a new Calc document named CalcTestMacros.ods.
  2. Use Tools > Macros > Organize Macros > OpenOffice.org Basic to open the OpenOffice.org Basic Macros dialog. The Macro from box lists available macro library containers. My Macros contains macros that you write or add to OOo. OpenOffice.org Macros contains macros included with OOo and should not be changed. All other library containers are currently open OOo documents.
  3. OpenOffice.org Basic Macros dialog.
  4. Click Organizer to open the OpenOffice.org Basic Macro Organizer dialog.
  5. OpenOffice.org Basic Macro Organizer.
  6. Click the Libraries tab.
  7. Select the document to contain the macro.
  8. Click New to open the New Library dialog.
  9. New Library dialog.
  10. Enter a descriptive library name (such as AuthorsCalcMacros) and click OK to create the library. The new library name is shown the library list, but the dialog may show only a portion of the name.
  11. The library is shown in the organizer.
  12. Select AuthorsCalcMacros and click Edit to edit the library. OOo automatically creates a module named Module1 and a macro named Main.
  13. Basic Integrated Development Environment (IDE).
  14. Modify the code so that it is the same as that shown in Listing 2. The important addition is the creation of the NumberFive function, which returns the number five. The statement Option Explicit forces all variables to be declared before they are used. If Option Explicit is omitted, variables are automatically defined at first use as type Variant.

Listing 2. Function that returns five.

 REM  *****  BASIC  *****
 Option Explicit

 Sub Main

 End Sub

 Function NumberFive()
   NumberFive = 5
 End Function 



OpenOffice Calc 3.x Guide
Previous Page Home Next Page

 
 
  Published under the terms of the Creative Commons License Design by Interspire