REM ***** BASIC *****
Sub Main
End Sub
RoryOF wrote:The moral of the story - the Win10 update may take a loo-oo-ong time - perhaps leave it overnight to update.
Philip Stott wrote:At least I think that is where I get to when I follow: Tools/Macros/Organize Macros/OpenOffice Basic
But I have come across a problem on the Windows 7 computer. Maths functions like SQRT, and LN bring the BASIC program to a stop with a message that this is an unknown function.
These functions work in the spreadsheet itself. How do I make BASIC recognize them ?
REM ***** BASIC *****
Option Explicit
Function MySquareRootStarBasic(TheNumber as double)
'There is not any error handling in this sample function - for example: for the negative inputs
MySquareRootStarBasic = Sqr(TheNumber)
end function
Function MySquareRootCalcCellfunction(TheNumber as double)
'There is not any error handling in this sample function - for example: for the negative inputs
Dim oFunctionAccess as object
Dim TheArray(0)
oFunctionAccess = createUnoService( "com.sun.star.sheet.FunctionAccess" )
TheArray(0) = TheNumber
MySquareRootCalcCellfunction = oFunctionAccess.CallFunction( "SQRT", TheArray())
end function
Function MyLogNatStarBasic(TheNumber as double)
'There is not any error handling in this sample function - for example: for the negative inputs
MyLogNatStarBasic = Log(TheNumber, Exp(1))
end function
Function MyLogNatCalcCellfunction(TheNumber as double)
'There is not any error handling in this sample function - for example: for the negative inputs
Dim oFunctionAccess as object
Dim TheArray(0)
oFunctionAccess = createUnoService( "com.sun.star.sheet.FunctionAccess" )
TheArray(0) = TheNumber
MyLogNatCalcCellfunction = oFunctionAccess.CallFunction( "LN", TheArray())
end function
I must say this a surprise - such a long-winded procedure for something so simple in the spreadsheet itself.
I will try your solution.
I must say this a surprise - such a long-winded procedure for something so simple in the spreadsheet itself. I will try your solution.
Users browsing this forum: No registered users and 6 guests