I’ve got a button, which can make me a new line, but I have to click somewhere to do it above.
So I need a change to make that new line above a cell with text “Total Sum”.
Here is my code right now:
sub New_Line
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")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$B$9"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertRowsBefore", "", 0, Array())
end sub
I think I need it to find the cell with that text and return the address of the cell, but I don’t understand this programming.
Thanks for every help.