I recorded a macro to search for the value AABRIEF, this word appears near the top of my document always, but is not always located in $A$12.
rem Search for the AABRIEF cell
args1(0).Name = "SearchItem.SearchString"
args1(0).Value = "AABRIEF"
The next step is to select the cell above AABRIEF and do the following:
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint"
args2(0).Value = "$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$A$1:$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:ClearContents", "", 0, Array())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
As mentioned before, rather than simply going to cell $A$12, because AABRIEF is located in $A$13 will not always work because it may not always be in $A$13.
In the ".uno:GoToCell"
below is there a way to select the cell the AABRIEF is located -1 cell?
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$A$1:$A$12"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())