Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you already have a cell object you can check for the properties .Type and .FormulaResultType.
If you passed a cell reference to the formula in Calc and your user function does not specify a type for the respective parameter, the parameter gives access to a Variant variable which you can can ask for its actual type with the help of the Basic function TypeName().

Any subroutine (even running for a non-Calc compoinent) can create a service for calling Calc functions.
To call a function you need to pass its name as a string and its arguments as an array.
Example:

Sub test()
fa = createUnoService("com.sun.star.sheet.FunctionAccess")  
MsgBox(fa.callFunction("ISNUMBER", Array("NaN")))
MsgBox(fa.callFunction("ISNUMBER", Array(fa.callFunction("PI", Array())))
End Sub

If you want to learn more and to understand better, you should study the famous texts by Andrew Pitonyak. You find them here.