Lupp,
I’m not sure what my reason has to do with a solution, but I have a large csv file that I had to split into many due to size. So for each one, I need to go into multiple cells, enter a formula for each (sorry for saying function in the post), so I thought I could use a macro so with one click could populate all the cells with the formulas, then repeat for the next spreadsheet, etc. I was testing with one cell to make sure it worked before doing for all. Here is the test macro:
sub test_formula
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
dim args2(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$H$1"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
args2(0).Name = "StringName"
args2(0).Value = "=if($B1=$A1,"true","false")"
dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args2())
end sub
Double quotes get inserted into string literals by doubling them like in "=IF(testResult;"""correct""";"""bad""")"
Does not work either.