[Solved] Call nested Calc function in Basic
Posted: Thu Jan 30, 2025 11:55 am
The formula can get rigth value in openoffice calc.
I want to write it in oobasic codes:
https://i.sstatic.net/L5ie9wdr.png
Code: Select all
=INDEX(B1:B47,MATCH("land",A1:A47,0))
Code: Select all
sub callindex()
dim oFunAccess as object
oFunAccess = createUnoService( "com.sun.star.sheet.FunctionAccess" )
dim oDoc, oSheet, oRange as object
oDoc = ThisComponent
oSheet = oDoc.sheets.getByName("Sheet1")
oRange = oSheet.getCellRangeByName("a1:a47")
dim embedded_formula as string
embedded_formula = "MATCH('land',A1:A47,0)"
num = oFunAccess.CallFunction( "index",array("b1:b47", embedded_formula))
print num
end sub