Darunter befindet sich ein Excel-VBA-Code, der eine Formel in die gewünschte Zelle in Spalte "A" zieht. Hier zum Beispiel zieht die Formel die Zeile bis zur Zeile 3000 .
sub drag_formula()
rem ----------------------------------------------------------------------
rem define variables
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")
With ThisComponent
.CurrentController.setActiveSheet(.Sheets.getByName("Planilha1"))
End With
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$A$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "EndCell"
args3(0).Value = "$A$3000"
dispatcher.executeDispatch(document, ".uno:AutoFill", "", 0, args3())
end Sub