Conteúdo
Índice 🔎︎

# Chamar funções do Calc

Além das funções nativas do BASIC, você pode chamar as funções do Calc nas suas macros ou scripts.

## Chamar funções internas do Calc no BASIC

Utilize a função CreateUNOService para acessar o serviço com.sun.star.sheet.FunctionAccess.

### Exemplo:

        REM  código abaixo não funciona para funções de suplemento, que tem um procedimento de chamada diferente.
        Function MyVlook(item, InRange As Object, FromCol As Integer)
            Dim oService As Object
            oService = createUnoService("com.sun.star.sheet.FunctionAccess")
            REM Sempre invoque as funções com seu nome em inglês
            MyVlook = oService.callFunction("VLOOKUP",Array(item, InRange, FromCol, True))
        End Function

## Chamar funções de suplemento do Calc no BASIC

As funções de suplemento estão no serviço com.sun.star.sheet.addin.Analysis.

### Exemplo:

    REM Exemplo de chamada da função RAIZPI
    Function MinhaRAIZPI(arg as double) as double
       Dim oService as Object
       oService = createUNOService("com.sun.star.sheet.addin.Analysis")
       MinhaRAIZPI = oService.getSqrtPi(arg)
    End Function

Calc Function name | UNO service name
JUROSACUM | com.sun.star.sheet.addin.Analysis.getAccrint
JUROSACUMV | 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
CUPDIASINLIQ | com.sun.star.sheet.addin.Analysis.getCoupdaybs
CUPDIAS | com.sun.star.sheet.addin.Analysis.getCoupdays
CUPDIASPRÓ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
IPGTO.CUM | com.sun.star.sheet.addin.Analysis.getCumipmt
PGTOPRINC | 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
DURAÇÃO | com.sun.star.sheet.addin.Analysis.getDuration
DATAM | com.sun.star.sheet.addin.Analysis.getEdate
EFETIVA | com.sun.star.sheet.addin.Analysis.getEffect
FIMMÊS | com.sun.star.sheet.addin.Analysis.getEomonth
FUNERRO | com.sun.star.sheet.addin.Analysis.getErf
FUNERROCOMPL | com.sun.star.sheet.addin.Analysis.getErfc
FATDUPLO | com.sun.star.sheet.addin.Analysis.getFactdouble
VFPLANO | com.sun.star.sheet.addin.Analysis.getFvschedule
MDC | com.sun.star.sheet.addin.Analysis.getGcd
DEGRAU | 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
IMAGINÁRIO | com.sun.star.sheet.addin.Analysis.getImaginary
IMARG | com.sun.star.sheet.addin.Analysis.getImargument
IMCONJ | 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
IMCOSEC | com.sun.star.sheet.addin.Analysis.getImcsc
IMCOSECH | 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
IMPROD | 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
IMSENH | com.sun.star.sheet.addin.Analysis.getImsinh
IMRAIZ | com.sun.star.sheet.addin.Analysis.getImsqrt
IMSUBTR | com.sun.star.sheet.addin.Analysis.getImsub
IMSOMA | com.sun.star.sheet.addin.Analysis.getImsum
IMTAN | com.sun.star.sheet.addin.Analysis.getImtan
TAXAJUROS | com.sun.star.sheet.addin.Analysis.getIntrate
ÉPAR | com.sun.star.sheet.addin.Analysis.getIseven
ÉÍMPAR | com.sun.star.sheet.addin.Analysis.getIsodd
MMC | com.sun.star.sheet.addin.Analysis.getLcm
MDURAÇÃO | com.sun.star.sheet.addin.Analysis.getMduration
MARRED | com.sun.star.sheet.addin.Analysis.getMround
MULTINOMIAL | com.sun.star.sheet.addin.Analysis.getMultinomial
DIATRABALHOTOTAL | 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
PREÇOPRIMINC | com.sun.star.sheet.addin.Analysis.getOddfprice
LUCROPRIMINC | com.sun.star.sheet.addin.Analysis.getOddfyield
PREÇOÚLTINC | com.sun.star.sheet.addin.Analysis.getOddlprice
LUCROÚLTINC | com.sun.star.sheet.addin.Analysis.getOddlyield
PREÇO | com.sun.star.sheet.addin.Analysis.getPrice
PREÇODESC | com.sun.star.sheet.addin.Analysis.getPricedisc
PREÇOVENC | com.sun.star.sheet.addin.Analysis.getPricemat
QUOCIENTE | com.sun.star.sheet.addin.Analysis.getQuotient
ALEATÓRIOENTRE | com.sun.star.sheet.addin.Analysis.getRandbetween
RECEBER | com.sun.star.sheet.addin.Analysis.getReceived
SOMASEQUÊNCIA | com.sun.star.sheet.addin.Analysis.getSeriessum
RAIZPI | com.sun.star.sheet.addin.Analysis.getSqrtpi
OTN | com.sun.star.sheet.addin.Analysis.getTbilleq
OTNVALOR | com.sun.star.sheet.addin.Analysis.getTbillprice
OTNLUCRO | com.sun.star.sheet.addin.Analysis.getTbillyield
NÚM.SEMANA | com.sun.star.sheet.addin.Analysis.getWeeknum
DIAÚTIL | com.sun.star.sheet.addin.Analysis.getWorkday
XTIR | com.sun.star.sheet.addin.Analysis.getXirr
XVPL | com.sun.star.sheet.addin.Analysis.getXnpv
FRAÇÃOANO | com.sun.star.sheet.addin.Analysis.getYearfrac
LUCRO | com.sun.star.sheet.addin.Analysis.getYield
LUCRODESC | com.sun.star.sheet.addin.Analysis.getYielddisc
LUCROVENC | com.sun.star.sheet.addin.Analysis.getYieldmat

Tópicos relacionados

Função CreateUnoService