J'ai testé avec =MYFUNC("parametre1","parametre2",CELLULE("Sheet"))
mais cela ne
fonctionne pas, on dirait qu'il ne connait pas thisComponent au
chargement du
fichier.
Function myfunc(param As String, param2 As String, index As Integer)
...
thisComponent.Sheets.getByIndex(index - 1)
...
End Function
Même résultat en passant par StarDesktop.CurrentComponent.
Comment faire une fonction personnalisée qui fait référence à la
feuille où la
fonction est appelée ?
!!! Je ne comprends pas très bien. Si c'est à partir de la feuille
active, quelle référence veux-tu appeler ?
Sinon, quelque chose comme ci-dessous doit fonctionner avec une saisie
de la forme : =MAFONCTION(32;45;"Feuille2")
function MaFonction( dPar1 as double, sPar2 as string, sName as string )
dim oSheet as object
oSheet = thisComponent.getSheets().getByName( sName )
with oSheet
.getCellByPosition( 5, 10 ).value = dPar1
.getCellByPosition( 5, 11 ).string = sPar2
end with
end function
Le problème survient au chargement du document lorsque je fais appel à ma
fonction personnalisée dans les différentes feuilles.
Function myfunc(param As String, param2 As String, index As Integer)
...
thisComponent.Sheets.getByIndex(index - 1)
...
End Function
Il ne connait pas thisComponent, j'ai regardé avec xray StarDesktop mais
tout les objets sont nuls.
Comment fait on pour accéder à la feuille où la fonction personnalisée est
appelée lors du chargement du document ?
Etant donnée que thisComponent est NULL.
Merci à vous.