Calling Calc Functions in Macros

Contido
Índice 🔎︎

# Calling Calc Functions

In addition to the native BASIC functions, you can call Calc functions in your macros and scripts.

## Calling Internal Calc functions in Basic

Use the CreateUNOService function to access the com.sun.star.sheet.FunctionAccess service.

### Exemplo:

        REM The code below does not work for add-in functions, which have a different calling procedure.
        Function MyVlook(item, InRange As Object, FromCol As Integer)
            Dim oService As Object
            oService = createUnoService("com.sun.star.sheet.FunctionAccess")
            REM Always use the function English name
            MyVlook = oService.callFunction("VLOOKUP",Array(item, InRange, FromCol, True))
        End Function

## Calling Add-In Calc Functions in BASIC

The Calc Add-In functions are in service com.sun.star.sheet.addin.Analysis.

### Exemplo:

    REM Example calling Addin function SQRTPI
    Function MySQRTPI(arg as double) as double
       Dim oService as Object
       oService = createUNOService("com.sun.star.sheet.addin.Analysis")
       MySQRTPI = oService.getSqrtPi(arg)
    End Function

Calc Function name | UNO service name
XUROSACUM | com.sun.star.sheet.addin.Analysis.getAccrint
XUROSACUMV | com.sun.star.sheet.addin.Analysis.getAccrintm
AMORDEGRC | com.sun.star.sheet.addin.Analysis.getAmordegrc
AMORLINC | com.sun.star.sheet.addin.Analysis.getAmorlinc
BESSELI | com.sun.star.sheet.addin.Analysis.getBesseli
BESSELJ | com.sun.star.sheet.addin.Analysis.getBesselj
BESSELK | com.sun.star.sheet.addin.Analysis.getBesselk
BESSELY | com.sun.star.sheet.addin.Analysis.getBessely
BINADEC | com.sun.star.sheet.addin.Analysis.getBin2Dec
BINAHEX | com.sun.star.sheet.addin.Analysis.getBin2Hex
BINAOCT | com.sun.star.sheet.addin.Analysis.getBin2Oct
COMPLEXO | com.sun.star.sheet.addin.Analysis.getComplex
CONVERTER | com.sun.star.sheet.addin.Analysis.getConvert
CUPDÍASATÉLIQ | com.sun.star.sheet.addin.Analysis.getCoupdaybs
CUPDÍAS | com.sun.star.sheet.addin.Analysis.getCoupdays
CUPDÍASPRÓX | com.sun.star.sheet.addin.Analysis.getCoupdaysnc
CUPDATAPRÓX | com.sun.star.sheet.addin.Analysis.getCoupncd
CUPNÚM | com.sun.star.sheet.addin.Analysis.getCoupnum
CUPDATAANT | com.sun.star.sheet.addin.Analysis.getCouppcd
PGTOXUROSACUM | com.sun.star.sheet.addin.Analysis.getCumipmt
PGTOPRINCACUM | com.sun.star.sheet.addin.Analysis.getCumprinc
DECABIN | com.sun.star.sheet.addin.Analysis.getDec2Bin
DECAHEX | com.sun.star.sheet.addin.Analysis.getDec2Hex
DECAOCT | com.sun.star.sheet.addin.Analysis.getDec2Oct
DELTA | com.sun.star.sheet.addin.Analysis.getDelta
DESC | com.sun.star.sheet.addin.Analysis.getDisc
MOEDADEC | com.sun.star.sheet.addin.Analysis.getDollarde
MOEDAFRA | com.sun.star.sheet.addin.Analysis.getDollarfr
DURACIÓN | com.sun.star.sheet.addin.Analysis.getDuration
DATAM | com.sun.star.sheet.addin.Analysis.getEdate
EFECTO | com.sun.star.sheet.addin.Analysis.getEffect
FINMES | com.sun.star.sheet.addin.Analysis.getEomonth
FUNERRO | com.sun.star.sheet.addin.Analysis.getErf
FUNERROCOMPL | com.sun.star.sheet.addin.Analysis.getErfc
FACTDUPLO | com.sun.star.sheet.addin.Analysis.getFactdouble
VFPROGRAMA | com.sun.star.sheet.addin.Analysis.getFvschedule
MDC | com.sun.star.sheet.addin.Analysis.getGcd
MAIOROUIGUAL | com.sun.star.sheet.addin.Analysis.getGestep
HEXABIN | com.sun.star.sheet.addin.Analysis.getHex2Bin
HEXADEC | com.sun.star.sheet.addin.Analysis.getHex2Dec
HEXAOCT | com.sun.star.sheet.addin.Analysis.getHex2Oct
IMABS | com.sun.star.sheet.addin.Analysis.getImabs
IMAXINARIO | com.sun.star.sheet.addin.Analysis.getImaginary
IMARGUMENTO | com.sun.star.sheet.addin.Analysis.getImargument
IMCONX | com.sun.star.sheet.addin.Analysis.getImconjugate
IMCOS | com.sun.star.sheet.addin.Analysis.getImcos
IMCOSH | com.sun.star.sheet.addin.Analysis.getImcosh
IMCOT | com.sun.star.sheet.addin.Analysis.getImcot
IMCSC | com.sun.star.sheet.addin.Analysis.getImcsc
IMCSCH | com.sun.star.sheet.addin.Analysis.getImcsch
IMDIV | com.sun.star.sheet.addin.Analysis.getImdiv
IMEXP | com.sun.star.sheet.addin.Analysis.getImexp
IMLN | com.sun.star.sheet.addin.Analysis.getImln
IMLOG10 | com.sun.star.sheet.addin.Analysis.getImlog10
IMLOG2 | com.sun.star.sheet.addin.Analysis.getImlog2
IMPOT | com.sun.star.sheet.addin.Analysis.getImpower
IMPRODUTO | com.sun.star.sheet.addin.Analysis.getImproduct
IMREAL | com.sun.star.sheet.addin.Analysis.getImreal
IMSEC | com.sun.star.sheet.addin.Analysis.getImsec
IMSECH | com.sun.star.sheet.addin.Analysis.getImsech
Imsin | com.sun.star.sheet.addin.Analysis.getImsin
IMSINH | com.sun.star.sheet.addin.Analysis.getImsinh
IMRAÍZ | com.sun.star.sheet.addin.Analysis.getImsqrt
IMSUBTR | com.sun.star.sheet.addin.Analysis.getImsub
IMSUMA | com.sun.star.sheet.addin.Analysis.getImsum
IMTAN | com.sun.star.sheet.addin.Analysis.getImtan
TAXAXUROS | com.sun.star.sheet.addin.Analysis.getIntrate
ÉPAR | com.sun.star.sheet.addin.Analysis.getIseven
ÉIMPAR | com.sun.star.sheet.addin.Analysis.getIsodd
MMC | com.sun.star.sheet.addin.Analysis.getLcm
MDURACIÓN | com.sun.star.sheet.addin.Analysis.getMduration
MARRED | com.sun.star.sheet.addin.Analysis.getMround
MULTINOMIAL | com.sun.star.sheet.addin.Analysis.getMultinomial
DÍASÚTILESTOTAIS | com.sun.star.sheet.addin.Analysis.getNetworkdays
NOMINAL | com.sun.star.sheet.addin.Analysis.getNominal
OCTABIN | com.sun.star.sheet.addin.Analysis.getOct2Bin
OCTADEC | com.sun.star.sheet.addin.Analysis.getOct2Dec
OCTAHEX | com.sun.star.sheet.addin.Analysis.getOct2Hex
PREZOPRIMIRR | com.sun.star.sheet.addin.Analysis.getOddfprice
BENEFPRIMIRR | com.sun.star.sheet.addin.Analysis.getOddfyield
PREZOÚLTIRR | com.sun.star.sheet.addin.Analysis.getOddlprice
BENEFÚLTIRR | com.sun.star.sheet.addin.Analysis.getOddlyield
PREZO | com.sun.star.sheet.addin.Analysis.getPrice
PREZODESC | com.sun.star.sheet.addin.Analysis.getPricedisc
PREZOVENC | com.sun.star.sheet.addin.Analysis.getPricemat
COCIENTE | com.sun.star.sheet.addin.Analysis.getQuotient
ALEATORIOENTRE | com.sun.star.sheet.addin.Analysis.getRandbetween
RECIBIDO | com.sun.star.sheet.addin.Analysis.getReceived
SUMARSECUENCIA | com.sun.star.sheet.addin.Analysis.getSeriessum
RAÍZPI | com.sun.star.sheet.addin.Analysis.getSqrtpi
LETTESEQ | com.sun.star.sheet.addin.Analysis.getTbilleq
LETTESPREZO | com.sun.star.sheet.addin.Analysis.getTbillprice
LETTESBENEF | com.sun.star.sheet.addin.Analysis.getTbillyield
SEMANACALENDARIO | com.sun.star.sheet.addin.Analysis.getWeeknum
DÍAÚTIL | com.sun.star.sheet.addin.Analysis.getWorkday
XTID | com.sun.star.sheet.addin.Analysis.getXirr
XVPL | com.sun.star.sheet.addin.Analysis.getXnpv
FRACCIÓNANO | com.sun.star.sheet.addin.Analysis.getYearfrac
BENEFICIOS | com.sun.star.sheet.addin.Analysis.getYield
BENEFDESC | com.sun.star.sheet.addin.Analysis.getYielddisc
BENEFVENC | com.sun.star.sheet.addin.Analysis.getYieldmat

Temas relacionados

Función CreateUnoService