473,396 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to cancel a copy selection in Excel?

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

Oct 30 '06 #1
3 16946
rng is the Range object. You should be able to use the Range object in C#
as well.

chanmm
"Siv" <do****@removeme.sivill.comwrote in message
news:BC**********************************@microsof t.com...
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

Oct 30 '06 #2
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

"chanmm" <ch*****@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
rng is the Range object. You should be able to use the Range object in C#
as well.

chanmm
"Siv" <do****@removeme.sivill.comwrote in message
news:BC**********************************@microsof t.com...
>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

Oct 31 '06 #3
Just a thought -- can you move the cursor?

-- Mark

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

Cheers for responding.

Siv

"chanmm" <ch*****@hotmail.comwrote in message
news:%2***************@TK2MSFTNGP03.phx.gbl...
>rng is the Range object. You should be able to use the Range object
in C# as well.

chanmm
"Siv" <do****@removeme.sivill.comwrote in message
news:BC**********************************@microso ft.com...
>>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

Oct 31 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Deano | last post by:
Alot of my forms are bound. I would like to offer a Cancel option so that they can make as many changes as they like and still Cancel out without making any changes. I have one idea of how to...
9
by: (Pete Cresswell) | last post by:
I see this coming on a develpment effort that may materialize shortly. These guys don't want to mess around with automated imports from text feeds BC in the past they've had too many problems...
1
by: AP | last post by:
Hi, I'm trying to use c# to pop up a dialog box when a user attempts to close word to prompt them if they want to exit or cancel (obviously other stuff needs to happen based on their selection...
2
by: Mansi | last post by:
I'm trying to automate excel from c#. One of the things I need to do is to copy/paste/insert rows in excel via c# code. I tried to do the following: 1) Select a row in excel (a12 to k12) 2)...
0
by: gcardozo | last post by:
Could anyone help me with the task of copying and pasting the values of changing cell references in excel using code for a macro?(macro to copy and paste values within a currently selected column). ...
0
by: dev121 | last post by:
Hi, I am currently trying to copy a single selected item from a listbox control in vba (excel). So far I have got this code, which doesn't work. <code> Private Sub btnAddNewOrder_Click()
2
by: ellipsism | last post by:
I'm using an excel sheet to keep track of a number of variable links (a few thousand) in a very large compiled matlab model. I have a python method that checks a variable link to see if it actually...
0
by: arindams | last post by:
I've a form where an webrowser contains a html file. I want to copy a selective portion of the html content and paste that content in an excel 2007 file where it will be pasted as a normal text (not...
4
by: adrianmepham | last post by:
Hi group, I have been given the task at work of producing a selection frogram for a range of our air handling units. I have a little experience of programing in VB 6 from many years ago, but...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.