Is there a way to copy a value of a current active cell to clipboard?
What i have to do in 1 macro:
Copy active cell from “sheet2”
paste is into a specific cell in “sheet1”
Copy a different cell from “sheet1”
Paste it into original cell into “sheet2”
Bangin my head against the wall on that one. For the simple reason of being a noob i’m stuck on step 1. The rest of the macro is working. The only thing is when i select a new cell with a mouse and run the macro, the previously selected cell is still copied.
Insight greatly appreciated.
sub plus15
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 ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Nr"
args2(0).Value = 1
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$D$6"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dim args4(5) as new com.sun.star.beans.PropertyValue
args4(0).Name = "Flags"
args4(0).Value = "D"
args4(1).Name = "FormulaCommand"
args4(1).Value = 0
args4(2).Name = "SkipEmptyCells"
args4(2).Value = false
args4(3).Name = "Transpose"
args4(3).Value = false
args4(4).Name = "AsLink"
args4(4).Value = false
args4(5).Name = "MoveMode"
args4(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args4())
rem ----------------------------------------------------------------------
dim args5(0) as new com.sun.star.beans.PropertyValue
args5(0).Name = "ToPoint"
args5(0).Value = "$D$8"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args7(0) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Nr"
args7(0).Value = 2
dispatcher.executeDispatch(document, ".uno:JumpToTable", "", 0, args7())
rem ----------------------------------------------------------------------
dim args8(5) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Flags"
args8(0).Value = "D"
args8(1).Name = "FormulaCommand"
args8(1).Value = 0
args8(2).Name = "SkipEmptyCells"
args8(2).Value = false
args8(3).Name = "Transpose"
args8(3).Value = false
args8(4).Name = "AsLink"
args8(4).Value = false
args8(5).Name = "MoveMode"
args8(5).Value = 4
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args8())
end sub`