Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2006

Tip: Looking for answers? Try searching our database.

How to cancel a copy selection in Excel?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Siv - 30 Oct 2006 01:14 GMT
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
chanmm - 30 Oct 2006 09:48 GMT
rng is the Range object.  You should be able to use the Range object in C#
as well.

chanmm

> Hi,
> Does anyone know how to cancel the selection of a block that has been
[quoted text clipped - 29 lines]
>
> Siv
Siv - 31 Oct 2006 16:54 GMT
I have looked at that and can't find anything that seems to cancel the
selection?
It's obviously obscure?

Cheers for responding.

Siv

> rng is the Range object.  You should be able to use the Range object in C#
> as well.
[quoted text clipped - 34 lines]
>>
>> Siv
Mark Jerde - 31 Oct 2006 19:17 GMT
Just a thought -- can you move the cursor?

  -- Mark

> I have looked at that and can't find anything that seems to cancel the
> selection?
[quoted text clipped - 41 lines]
>>>
>>> Siv

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.