| View previous topic :: View next topic |
| Author |
Message |
chrizio General User

Joined: 11 Apr 2006 Posts: 21
|
Posted: Fri Sep 29, 2006 11:26 am Post subject: Creating own functions - programmers guide |
|
|
Hi,
I didn't manage to find on the OOo portal any good guide
about creating / programming own Calc functions.
I have to write some functions to be used in my Calc sheet.
Where can I study the underlying programming language ?
My current question on writing user defined functions is following:
The function shall take some number of cells containing one integer
pro cell as an array - input parameter.
How must be such function be defined ? |
|
| Back to top |
|
 |
chrizio General User

Joined: 11 Apr 2006 Posts: 21
|
Posted: Fri Sep 29, 2006 12:31 pm Post subject: |
|
|
Calc is someway strange.
Why does following function
FUNCTION aaa(ByVal x As INTEGER) As INTEGER
DIM s%
s=x
return s
End Function
generate compiling error as below ?
"Basic syntax error - label s undefined" <- message translated from German
The function is placed in My Macros->Standard->xxxx |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Fri Sep 29, 2006 9:31 pm Post subject: |
|
|
I use "return" in conjunction with GoSub.
Other values are mentioned in the API index R but none seem relevant here. _________________ search forum by month |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8995 Location: Lexinton, Kentucky, USA
|
Posted: Sat Sep 30, 2006 8:08 am Post subject: |
|
|
You return the value of a function by setting the function name = value so try
aaa = s
instead of
return s. |
|
| Back to top |
|
 |
chrizio General User

Joined: 11 Apr 2006 Posts: 21
|
Posted: Sat Sep 30, 2006 8:19 am Post subject: |
|
|
Thanks for all answers.
That with return xxxx I have found just in forum or in help.
It wasn't my own invention. |
|
| Back to top |
|
 |
|