Ask Your Question
0

BASIC runtime error. Sub-procedure or function procedure not defined

asked 2018-11-02 21:24:59 +0100

student gravatar image

I tried the following test macro in libreoffice, but get an error:

"BASIC runtime error. Sub-procedure or function procedure not defined"

Function Test(x)
Test=Round(x^(0.5),1)
End Function

How can I fix it?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-11-02 21:38:20 +0100

Ratslinger gravatar image

updated 2018-11-02 21:39:25 +0100

Hello,

Round is a function called from the sheet. You can use these in macros but must do so by a call using arguments:

Function Test(x)
    oFunction = createUnoService("com.sun.star.sheet.FunctionAccess")
    dim aArgument(1) as variant
    aArgument(0)=x^(0.5)
    aArgument(1)=1
    Test = oFunction.callFunction( "Round", aArgument() )
End Function
edit flag offensive delete link more

Comments

Thanks, is there also a function accessible directly from basic which does the same as the round function from the sheet?

student gravatar imagestudent ( 2018-11-02 22:17:26 +0100 )edit

Don't see any command in Basic for that.

Ratslinger gravatar imageRatslinger ( 2018-11-02 22:28:27 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-11-02 21:24:59 +0100

Seen: 452 times

Last updated: Nov 02 '18