OpenOffice.org video based manual
Plan-B for OpenOffice.org, learning office productivity software with videos


Tech Support for OpenOffice.org
Applications
Go to Open Office Writer Index
Go to Open Office Impress Index
Go to Open Office Math Index
Go to Open Office Draw Index
Go to Open Office Calc Index
Go to Open Office Base Index
Go to Open Office Online Help Index

Help Sections:
General
Writer
Impress
Math
Draw
Calc
Base
Basic
mw changed one index entry to make it a one level entry

User-Defined Functions

You can apply user-defined functions in OpenOffice.org Calc in the following ways:

  • You can define your own functions using the Basic-IDE. This method requires a basic knowledge of programming.

  • You can program functions as add-ins. This method requires an advanced knowledge of programming.

Defining A Function Using OpenOffice.org Basic

  1. Choose Tools - Macros - Organize Macros - OpenOffice.org Basic.

  2. Click the Edit button. You will now see the Basic IDE.

  3. Enter the function code. In this example, we define a VOL(a; b; c) function that calculates the volume of a rectangular solid with side lengths a, b and c:

    Function VOL(a, b, c)
    VOL = a*b*c
    End Function

  4. Close the Basic-IDE window.

    Your function is automatically saved in the default module and is now available. If you apply the function in a Calc document that is to be used on another computer, you can copy the function to the Calc document as described in the next section.

Copying a Function To a Document

In stage 2 of "Defining A Function Using OpenOffice.org Basic", in the Macro dialog you clicked on Edit . As the default, in the Macro from field the My Macros - Standard - Module1 module is selected. The Standard library resides locally in your user directory.

If you want to copy the user-defined function to a Calc document:

  1. Choose Tools - Macros - Organize Macros - OpenOffice.org Basic .

  2. In the Macro from field select My Macros - Standard - Module1 and click Edit.

  3. In the Basic-IDE, select the source of your user-defined function and copy it to the clipboard.

  4. Close the Basic-IDE.

  5. Choose Tools - Macros - Organize Macros - OpenOffice.org Basic .

  6. In the Macro from field select (Name of the Calc document) - Standard - Module1. Click Edit.

  7. Paste the clipboard contents in the Basic-IDE of the document.

Applying a User-defined Function in OpenOffice.org Calc

Once you have defined the function VOL(a; b; c) in the Basic-IDE, you can apply it the same way as the built-in functions of OpenOffice.org Calc.

  1. Open a Calc document and enter numbers for the function parameters a, b, and c in cells A1, B1, and C1.

  2. Set the cursor in another cell and enter the following:

    =VOL(A1;B1;C1)

  3. The function is evaluated and you will see the result in the selected cell.

Index

functions, user-defined

user-defined functions

Basic IDE for user-defined functions

IDE, Basic IDE

programming,functions

This help text is published from the OpenOffice-Help files under the Public Documentation License 1.0.

Get OpenOffice.org - Free!