Richiamare funzioni Calc nelle macro

Contenuto
Indice 🔎︎

# Richiamare funzioni Calc

In aggiunta alle funzioni native di BASIC, potete richiamare le funzioni di Calc nelle macro e negli script.

## Richiamare funzioni interne di Calc in Basic

Usate la funzione CreateUNOService per accedere al servizio com.sun.star.sheet.FunctionAccess.

### Esempio:

        REM Il codice sottostante non viene eseguito dalle funzioni degli add-in, che hanno una diversa procedura per le chiamate.
        Function MyVlook(item, InRange As Object, FromCol As Integer)
            Dim oService As Object
            oService = createUnoService("com.sun.star.sheet.FunctionAccess")
            REM Usare sempre il nome inglese della funzione
            MyVlook = oService.callFunction("VLOOKUP",Array(item, InRange, FromCol, True))
        End Function

## Richiamare funzioni degli add-in di Calc in BASIC

Le funzioni Add-in di Calc si trovano nel servizio com.sun.star.sheet.addin.Analysis.

### Esempio:

    REM Esempio di chiamata alla funzione add-in SQRTPI
    Function MySQRTPI(arg as double) as double
       Dim oService as Object
       oService = createUNOService("com.sun.star.sheet.addin.Analysis")
       MySQRTPI = oService.getSqrtPi(arg)
    Funzione End

Calc Function name | UNO service name
INT.MATURATO.PER | com.sun.star.sheet.addin.Analysis.getAccrint
INT.MATURATO.SCAD | com.sun.star.sheet.addin.Analysis.getAccrintm
AMMORT.DEGR | com.sun.star.sheet.addin.Analysis.getAmordegrc
AMMORT.PER | com.sun.star.sheet.addin.Analysis.getAmorlinc
BESSEL.I | com.sun.star.sheet.addin.Analysis.getBesseli
BESSEL.J | com.sun.star.sheet.addin.Analysis.getBesselj
BESSEL.K | com.sun.star.sheet.addin.Analysis.getBesselk
BESSEL.Y | com.sun.star.sheet.addin.Analysis.getBessely
BINARIO.DECIMALE | com.sun.star.sheet.addin.Analysis.getBin2Dec
BINARIO.HEX | com.sun.star.sheet.addin.Analysis.getBin2Hex
BINARIO.OCT | com.sun.star.sheet.addin.Analysis.getBin2Oct
COMPLESSO | com.sun.star.sheet.addin.Analysis.getComplex
CONVERTI | com.sun.star.sheet.addin.Analysis.getConvert
GIORNI.CED.INIZ.LIQ | com.sun.star.sheet.addin.Analysis.getCoupdaybs
GIORNI.CED | com.sun.star.sheet.addin.Analysis.getCoupdays
GIORNI.CED.NUOVA | com.sun.star.sheet.addin.Analysis.getCoupdaysnc
DATA.CED.SUCC | com.sun.star.sheet.addin.Analysis.getCoupncd
NUM.CEDOLA | com.sun.star.sheet.addin.Analysis.getCoupnum
DATA.CED.PREC | com.sun.star.sheet.addin.Analysis.getCouppcd
INT.CUMUL | com.sun.star.sheet.addin.Analysis.getCumipmt
CAP.CUM | com.sun.star.sheet.addin.Analysis.getCumprinc
DECIMALE.BINARIO | com.sun.star.sheet.addin.Analysis.getDec2Bin
DECIMALE.HEX | com.sun.star.sheet.addin.Analysis.getDec2Hex
DECIMALE.OCT | com.sun.star.sheet.addin.Analysis.getDec2Oct
DELTA | com.sun.star.sheet.addin.Analysis.getDelta
TASSO.SCONTO | com.sun.star.sheet.addin.Analysis.getDisc
VALUTA.DEC | com.sun.star.sheet.addin.Analysis.getDollarde
VALUTA.FRAZ | com.sun.star.sheet.addin.Analysis.getDollarfr
DURATA | com.sun.star.sheet.addin.Analysis.getDuration
DATA.MESE | com.sun.star.sheet.addin.Analysis.getEdate
INT.EFFETTIVO | com.sun.star.sheet.addin.Analysis.getEffect
FINE.MESE | com.sun.star.sheet.addin.Analysis.getEomonth
FUNZ.ERRORE | com.sun.star.sheet.addin.Analysis.getErf
FUNZIONE.ERRORE.COMP | com.sun.star.sheet.addin.Analysis.getErfc
FATT.DOPPIO | com.sun.star.sheet.addin.Analysis.getFactdouble
VAL.FUT.CAPITALE | com.sun.star.sheet.addin.Analysis.getFvschedule
MCD | com.sun.star.sheet.addin.Analysis.getGcd
SOGLIA | com.sun.star.sheet.addin.Analysis.getGestep
HEX.BINARIO | com.sun.star.sheet.addin.Analysis.getHex2Bin
HEX.DECIMALE | com.sun.star.sheet.addin.Analysis.getHex2Dec
HEX.OCT | com.sun.star.sheet.addin.Analysis.getHex2Oct
COMP.MODULO | com.sun.star.sheet.addin.Analysis.getImabs
COMP.IMMAGINARIO | com.sun.star.sheet.addin.Analysis.getImaginary
COMP.ARGOMENTO | com.sun.star.sheet.addin.Analysis.getImargument
COMP.CONIUGATO | com.sun.star.sheet.addin.Analysis.getImconjugate
COMP.COS | com.sun.star.sheet.addin.Analysis.getImcos
COMP.COSH | com.sun.star.sheet.addin.Analysis.getImcosh
COMP.COT | com.sun.star.sheet.addin.Analysis.getImcot
COMP.COSEC | com.sun.star.sheet.addin.Analysis.getImcsc
COMP.COSECH | com.sun.star.sheet.addin.Analysis.getImcsch
COMP.DIV | com.sun.star.sheet.addin.Analysis.getImdiv
COMP.EXP | com.sun.star.sheet.addin.Analysis.getImexp
COMP.LN | com.sun.star.sheet.addin.Analysis.getImln
COMP.LOG10 | com.sun.star.sheet.addin.Analysis.getImlog10
COMP.LOG2 | com.sun.star.sheet.addin.Analysis.getImlog2
COMP.POTENZA | com.sun.star.sheet.addin.Analysis.getImpower
COMP.PRODOTTO | com.sun.star.sheet.addin.Analysis.getImproduct
COMP.PARTE.REALE | com.sun.star.sheet.addin.Analysis.getImreal
COMP.SEC | com.sun.star.sheet.addin.Analysis.getImsec
COMP.SECH | com.sun.star.sheet.addin.Analysis.getImsech
COMP.SEN | com.sun.star.sheet.addin.Analysis.getImsin
COMP.SENH | com.sun.star.sheet.addin.Analysis.getImsinh
COMP.RADQ | com.sun.star.sheet.addin.Analysis.getImsqrt
COMP.DIFF | com.sun.star.sheet.addin.Analysis.getImsub
COMP.SOMMA | com.sun.star.sheet.addin.Analysis.getImsum
COMP.TAN | com.sun.star.sheet.addin.Analysis.getImtan
TASSO.INT | com.sun.star.sheet.addin.Analysis.getIntrate
VAL.PARI | com.sun.star.sheet.addin.Analysis.getIseven
VAL.DISPARI | com.sun.star.sheet.addin.Analysis.getIsodd
MCM | com.sun.star.sheet.addin.Analysis.getLcm
DURATA.M | com.sun.star.sheet.addin.Analysis.getMduration
ARROTONDA.MULTIPLO | com.sun.star.sheet.addin.Analysis.getMround
MULTINOMIALE | com.sun.star.sheet.addin.Analysis.getMultinomial
GIORNI.LAVORATIVI.TOT | com.sun.star.sheet.addin.Analysis.getNetworkdays
NOMINALE | com.sun.star.sheet.addin.Analysis.getNominal
OCT.BINARIO | com.sun.star.sheet.addin.Analysis.getOct2Bin
OCT.DECIMALE | com.sun.star.sheet.addin.Analysis.getOct2Dec
OCT.HEX | com.sun.star.sheet.addin.Analysis.getOct2Hex
PREZZO.PRIMO.IRR | com.sun.star.sheet.addin.Analysis.getOddfprice
REND.PRIMO.IRR | com.sun.star.sheet.addin.Analysis.getOddfyield
PREZZO.ULTIMO.IRR | com.sun.star.sheet.addin.Analysis.getOddlprice
REND.ULTIMO.IRR | com.sun.star.sheet.addin.Analysis.getOddlyield
PREZZO | com.sun.star.sheet.addin.Analysis.getPrice
PREZZO.SCONT | com.sun.star.sheet.addin.Analysis.getPricedisc
PREZZO.SCAD | com.sun.star.sheet.addin.Analysis.getPricemat
QUOZIENTE | com.sun.star.sheet.addin.Analysis.getQuotient
CASUALE.TRA | com.sun.star.sheet.addin.Analysis.getRandbetween
RICEV.SCAD | com.sun.star.sheet.addin.Analysis.getReceived
SOMMA.SERIE | com.sun.star.sheet.addin.Analysis.getSeriessum
RADQ.PI.GRECO | com.sun.star.sheet.addin.Analysis.getSqrtpi
BOT.EQUIV | com.sun.star.sheet.addin.Analysis.getTbilleq
BOT.PREZZO | com.sun.star.sheet.addin.Analysis.getTbillprice
BOT.REND | com.sun.star.sheet.addin.Analysis.getTbillyield
NUM.SETTIMANA | com.sun.star.sheet.addin.Analysis.getWeeknum
GIORNO.LAVORATIVO | com.sun.star.sheet.addin.Analysis.getWorkday
TIR.X | com.sun.star.sheet.addin.Analysis.getXirr
VAN.X | com.sun.star.sheet.addin.Analysis.getXnpv
FRAZIONE.ANNO | com.sun.star.sheet.addin.Analysis.getYearfrac
REND | com.sun.star.sheet.addin.Analysis.getYield
REND.TITOLI.SCONT | com.sun.star.sheet.addin.Analysis.getYielddisc
REND.SCAD | com.sun.star.sheet.addin.Analysis.getYieldmat

Argomenti correlati

Funzione CreateUnoService