The value of application.cutCopyMode indicates if there is something ready either to be copy-pasted or cut-pasted. There are three possible values:
false (= 0)
Nothing is selected to be cut-pasted or copy pasted
xlCopy (= 1)
Selection will be copied to destination
xlCut (= 2)
Selection will be cut out from source and copied to destination
If Excel is either in copy or cut mode, the selected region is displayed with a dashed green border. Otherwise, the selection has a solid green border.
option explicit
sub main() ' {
application.width = 500
application.height = 400
[ b2:e4 ] = [{ "abc","def",2490,6104 ; "ghi","jkl",2828,96344 ; "mno","pqr",19041,940902 }]
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to select a region"
[ c3:d4 ].select
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to simulate ctrl-c (copy)"
selection.copy
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to select the destination cell"
[ b5 ].select
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to simulate ctrl-v (paste)"
activeSheet.paste
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to 'unselect' selected from region"
application.cutCopyMode = false
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to select another region"
[ e2:e3 ].select
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to simulate ctrl-x (cut)"
selection.cut
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to select the destination cell"
[ a3 ].select
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "Going to simulate ctrl-v (paste)"
activeSheet.paste
msgBox "cutCopyMode = " & cutCopyModeToString & chr(10) & "finished"
end sub ' }
function cutCopyModeToString() as string ' {
select case application.cutCopyMode
case false : cutCopyModeToString = "false"
case xlCopy: cutCopyModeToString = "xlCopy"
case xlCut : cutCopyModeToString = "xlCut"
case else : cutCopyModeToString = "???"
end select
end function ' }
In the following image, cutCopyMode is xlCopy, so the border is green-dashed. Unfortunately, when using SnippingTool.exe to take a screen shot, the dashed border is lost. Hence, the picture shows it (wrongly) in solid.
The border is drawn green-dashed, here also, but again copied wrongly by SnippingTool.exe.
Here's the same problem as before: the border is originally drawn green-dashed, but because of the limitation of SnippingTool.exe, it is solid again: