How to cancel a copy selection in Excel?

  • Thread starter Thread starter Siv
  • Start date Start date
S

Siv

Hi,
Does anyone know how to cancel the selection of a block that has been copied
programmatically using C# and Excel Interop.

This is my current code:

rng=XLApp.get_Range("OrigRows",m); //selects the
row named OrigRows
XLApp.CutCopyMode = XlCutCopyMode.xlCopy;
rng.Select();
rng.Copy(m);
rng.Insert(XlInsertShiftDirection.xlShiftDown,m);

The above copies teh selected row in a sheet and then pastes it as a new
row.
Next I just want to cancel the selection, if I record the action of pressing
"Esc" in Excel it gives the code:

Application.CutCopyMode = False

When I try to do the same thing in C# I only get offered two options:

XlCutCopyMode.xlCopy
XlCutCopyMode.xlCut

How do I say:

XLApp.CutCopyMode=false;

As usual C# and VBA are highly incompatible (why???).

Siv
 
rng is the Range object. You should be able to use the Range object in C#
as well.

chanmm
 
I have looked at that and can't find anything that seems to cancel the
selection?
It's obviously obscure?

Cheers for responding.

Siv
 
Back
Top