Ask Your Question

Wolbee's profile - activity

2016-01-18 16:06:00 +0100 received badge  Famous Question (source)
2016-01-18 16:06:00 +0100 received badge  Notable Question (source)
2016-01-18 16:06:00 +0100 received badge  Popular Question (source)
2015-10-20 15:56:26 +0100 asked a question Calc: macro to copy, paste, then clear clipboard

(Using LO Calc 5.0.2.2 64-bit on Windows 10, both Eng-UK)

I've got a macro that I recorded to copy and paste a range of cells, but when it finishes, I'm left with the dashed lines around the data that was copied.

I'm basically looking for a LO equivalent to VBA's "Application.CutCopyMode = False" to clear the copied data.

Here's my macro (apologies for nonsense attributed to recorded macro):

sub DailyXP
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 = "$F$2:$F$30"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())

rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$C$2:$C$30"

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 = "SVDT"
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 ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:TerminateInplaceActivation", "", 0, Array())

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:Cancel", "", 0, Array())


end sub