I can’t get macros to work properly!
I record a macro that sums 4 cells and then copies the value of that sum into an adjacent cell (so I can move the cells with the values later without worrying about the formulas). But when I play the macro nothing happens, except the cursor moves down 2 cells… What’s the problem?
I have LibreOffice ver. 6.4.7.2, which comes with Ubuntu 20.04. I even installed ver. 7.1.5.2, but it has exactly the same problem.
edit by @karolus actually we need more info, please copy&paste your macro_code …:
sub dode_sum_copy
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 = "By"
args1(0).Value = 1
dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "By"
args2(0).Value = 1
dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "By"
args3(0).Value = 1
dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "By"
args4(0).Value = 1
dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(1) as new com.sun.star.beans.PropertyValue
args5(0).Name = "By"
args5(0).Value = 1
args5(1).Name = "Sel"
args5(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5())
rem ----------------------------------------------------------------------
dim args6(1) as new com.sun.star.beans.PropertyValue
args6(0).Name = "By"
args6(0).Value = 1
args6(1).Name = "Sel"
args6(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoUp", "", 0, args6())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args8(1) as new com.sun.star.beans.PropertyValue
args8(0).Name = "By"
args8(0).Value = 1
args8(1).Name = "Sel"
args8(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args8())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:PasteOnlyValue", "", 0, Array())
rem ----------------------------------------------------------------------
dim args10(1) as new com.sun.star.beans.PropertyValue
args10(0).Name = "By"
args10(0).Value = 1
args10(1).Name = "Sel"
args10(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args10())
rem ----------------------------------------------------------------------
dim args11(1) as new com.sun.star.beans.PropertyValue
args11(0).Name = "By"
args11(0).Value = 1
args11(1).Name = "Sel"
args11(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args11())
rem ----------------------------------------------------------------------
dim args12(1) as new com.sun.star.beans.PropertyValue
args12(0).Name = "By"
args12(0).Value = 1
args12(1).Name = "Sel"
args12(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args12())
end sub