--enrico wrote:
       oSheet = ThisComponent.CurrentController.ActiveSheet
       CellRange = oSheet.getCellRangeByName("A1:A19")
> [...]
sto lavorando con OpenOffice 2.0; la tabella base si chiama appunto "BASE" e la tabella dove ho l'elenco dei nomi si chiama "Elenco" (che fantasia!!) [...] se guardo il valore della variabile *destName* mi restituisce 0 e ciò non é sicuramente giusto.

Mi sembrava funzionasse... forse ho provato sulla 1.1.4?

Questo è una macro scritta con un po' più di giudizio:

Sub Main
 oSheets = ThisComponent.Sheets
' Accedo direttamente alla tabella Elenco
 oSheet = oSheets.getbyname("Elenco")

 CellRange = oSheet.getCellRangeByName("A1:A19")
 n = CellRange.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT)

 srcName="BASE"
 for i = 0 to n-1
  destName = CellRange.GetCellByPosition(0,i).getvalue()
   If NOT oSheets.hasbyName(destName) Then
    oSheets.copyByName(srcName,destName,i)
   else
    print "Attenzione, esiste già una tabella con nome", destName
   End If
 next i
End Sub

Ciao,
--
MC

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Rispondere a