Ho pacioccato fino ad ottenere questo modo: ho ottenuto l'elenco a partire dalla riga a14 della distinta, mi fa il ciclo ma mi scrive sempre in tutte le celle il valore della cella B7 del primo foglio MENTRE NEL A15 DOVREBBE SCRIVERE IL VALORE DELLA CELLA DEL SECONDO FOGLIO E COSI VIA... AIUTOOOOOO!!! URGENTEEEE
codice:
SUB DISTINTA
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
thiscomponent.currentcontroller.activesheet = _
thiscomponent.sheets.getbyname("DISTINTA")
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$A$14"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
dim OBJSTS as object ' VAR. OGGETTO x INSIEME SHEETS
dim IDSH as integer ' VAR. NUMERICA x CONTEGGIO SHEETS
dim NMSH as string ' VAR, PER NOME SHEET DI CICLO
OBJSTS = thiscomponent.sheets
dim args6(400) as new com.sun.star.beans.PropertyValue
for IDSH = 0 to OBJSTS.count - 5 ' CICLO SU CONTEGGIO SHEETS
NMSH = OBJSTS.getbyindex(IDSH).name ' SCRIVO NOME SHEET DI CICLO IN VAR.
oCalcDocument = ThisComponent
oSheets = oCalcDocument.getSheets()
oSheet = oSheets(idsh)
oCell = oSheet.getCellByPosition(1, 6) ' b7
' msgbox "Prova contenuto b7 fogli: " & ocell.string & " " & idsh
thiscomponent.currentcontroller.activesheet = _
thiscomponent.sheets.getbyname("DISTINTA")
'------------------------------------------------------------------------
rem ----------------------------------------------------------------------
'dim args6(6) as new com.sun.star.beans.PropertyValue
args6(idsh).Name = "StringName"
'args6(0).Value = "='" & nomefoglio &"'.j16" ' DA CHANCE IN BASE A ULTIMA DATA - VEDI FORUM ------------------------------------------------------
args6(idsh).Value = ocell.string
msgbox idsh
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args6())
dispatcher.executeDispatch(document, ".uno:JumpToNextCell", "", 0, Array())
idsh=idsh +1
next IDSH ' CHIUDO CICLO SU ELENCO SHEETS
rem ----------------------------------------------------------------------
END SUB