>[EMAIL PROTECTED] a écrit : >> Bonjour, >> >Re, >> Les points d'arrêt fonctionnent sur les fonctions mais pas les "Sub" ??? >> >Ben, Si ...
Ben , Non ... >> Cela m'a permis de découvrir qu'il est très difficile d'avoir une aide en >> ligne (je n'ai pas Microsoft Developper Studio) >Ca tombe bien parce OOo n'y figure pas ;-) Je pensais au texte dans http://api.openoffice.org/ : "A new precompiled set of UNOIDL reference help file for the Microssoft Developer Studio (Windows only) is available. Download OpenOffice.org2.0.2_API_Reference_Manual.zip, extract it into a new empty folder and run the register.cmd to register the help files in your system. For the registration you will need hxreg.exe from the "Microsoft Help 2.0 SDK". Restart your MSDev and have fun with the comfortable search function. For more information how to compile the help files on your own and for trouble shouting hints see the wiki info Integrate Custom Help Into MSDEV." >> lorsque l'on rencontre >> l'erreur suivante "Variable d'objet non définie". >> >Variable appelée mais non déclarée préalablement ( cas avec l'option >"explicit"). il faut donc déclarer ta variable (Dim ou autre) comme dans >n'importe quel basic, oserais-je ;-) J'ai construit en VBA une fonction équivalente à SOMME.SI ' Equivalent de SOMME.SI Public Function SommeProduitSi(test As Range, colonne1 As Range, colonne2 As Range) As Double Dim SPS As Double Dim i as integer SPS = 0 For i = 1 To test.Rows.Count If test.Cells(i, 1).Value Then SPS = SPS + colonne1.Cells(i, 1).Value * colonne2.Cells(i, 1).Value End If Next SommeProduitSi = SPS End Function Lorsque j'ai essayé de la traduire en basic OoO, cela donne : Public Function SommeProduitSi(test As com.sun.star.table.CellRange, colonne1 As com.sun.star.table.CellRange, colonne2 As com.sun.star.table.CellRange) As Double Dim SPS As Double Dim i as integer ' Xray.XRay test SPS = 0 For i = 0 To test.getRows().getCount() - 1 If test.getCellByPosition(0,1).Value Then SPS = SPS + colonne1.getCellByPosition(0,i-1).Value * colonne2.getCellByPosition(0,i-1).Value End If Next SommeProduitSi = SPS End Function j'ai aussi utilisé comme type pour les paramètres d'entrée "Object" ou "com.sun.star.sheet.SheetCellRange", mais j'obtiens toujours l'erreur dès "test.getRows().getCount()". Les liens que tu m'a fournis Serge sont interessants mais j'ai toujours du mal à repérer l'information "nombre de lignes dans une rangée de cellules" obtenues lors de l'appel d'une fonction comme "=SOMMEPRODUITSI(C19:C31;D19:D31;G19:G31)" cordialement, Olivier