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

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?

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

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

Don’t see any command in Basic for that.