How to cancel a copy selection in Excel?

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
 
C

chanmm

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

chanmm
 
S

Siv

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

Cheers for responding.

Siv
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top