rounding in a user-defined function

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Rainer
Posts: 5
Joined: Wed Apr 09, 2008 10:00 am

rounding in a user-defined function

Post by Rainer »

Hi,

how can I round a value in a user-defined function

Rainer
User avatar
Villeroy
Volunteer
Posts: 31344
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: rounding in a user-defined function

Post by Villeroy »

In a spreadsheet?
=ROUND(myFunction(args);2)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Rainer
Posts: 5
Joined: Wed Apr 09, 2008 10:00 am

Re: rounding in a user-defined function

Post by Rainer »

Hi Villeory,

I know how to round in a spreadsheet itself, but how do I in a user-defined function?

e.g.

Function Test as Single
Dim value as Single

value = 2 / 3
Test = ROUND(value,1)
End Function

The examples doesn't work?


Rainer
User avatar
Villeroy
Volunteer
Posts: 31344
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: rounding in a user-defined function

Post by Villeroy »

Do yourself a favour and let it happen on the sheet if possible. Search this forum as well as oooforum.org for keywords "FunctionAccess" and "callFunction". Service "FunctionAccess" includes a lot of pitfalls if you are not familiar with this beast of an API.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply