On 4/23/05, Jahn, Ray (R.) <[EMAIL PROTECTED]> wrote:
> I am at a loss as how to call the built-in spreadsheet functions from scripts 
> in OO 1.9.95, given the apparent conflict above.  An equivalent example in MS 
> Excel VBA is given below.  Please advise if there is a better documentation 
> to follow.

I've posted a solution to a similar question in the past, which you
can find here:

http://sc.openoffice.org/servlets/ReadMsg?list=dev&msgNo=1391

>  --- MS Excel VBA equivalent example
> 
> dim answer as double
> double = Application.min( num_1, cellobj_2, rangeobj_3, num_4 )
> 
> ' same as the following
> ' double = Application.worksheetfunction.min( num_1, cellobj_2, rangeobj_3, 
> num_4 )

To call the built-in MIN function, use the following basic code as an example:

Sub callFunction

        svc = createUnoService( "com.sun.star.sheet.FunctionAccess" )
        
        ' Calculate min of numbers.
        arg = array( 10, 23, 5, 345 )
        print svc.callFunction( "MIN", arg )

        ' Calculate min of values in cell range A1:A17
        oSheet = ThisComponent.Sheets(0) ' Get leftmost sheet
        oCellRange = oSheet.getCellRangeByPosition( 0, 0, 0, 16 ) 'A1:A17
        arg = array( oCellRange )
        print svc.callFunction( "MIN", arg )
        
End Sub

HTH,

Kohei

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to