Tempo fa per mi era stata passata questa macro
Codice: Seleziona tutto
Sub _clearGraphs(Target)
oDrawPages = ThisComponent.getDrawPages()
If oDrawPages.hasElements() Then
For i = 0 To oDrawPages.getCount() - 1 REM # For all drawpages in workbook
oDrawPage = oDrawPages.getByIndex(i)
If oDrawPage.hasElements() Then
For j = (oDrawPage.getCount() - 1) To 0 Step -1
oShape = oDrawPage.getByIndex(j)
oDrawPage.remove(oShape)
Next j
EndIf
Next i
EndIf
End Sub
Ho notato che questa macro cancella anche tutti i campi dei formulari, perchè probabilmente vengono letti come oggetti disegno.
Quello che a me interessa è capire come lavora la funzione
Codice: Seleziona tutto
ThisComponent.getDrawPages()
Codice: Seleziona tutto
SH.getDrawPages()
Una seconda domanda è: c'è una differenza e penso sia legata all'oggetto attivo, ma .... qual'è la differenza tra Target e ThisComponent? Partendo dal presuppsto che Target dovrebbe essere l'evento, ovvero la variabile passata alla chiamata di una funzione:
Sub Nomefunzione(Target)
Grazie a tutti