Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: IOException and Number formatting Pin
Henry Minute2-Jul-09 2:20
Henry Minute2-Jul-09 2:20 
GeneralRe: IOException and Number formatting Pin
musefan2-Jul-09 2:23
musefan2-Jul-09 2:23 
AnswerRe: IOException and Number formatting Pin
Megidolaon2-Jul-09 11:27
Megidolaon2-Jul-09 11:27 
QuestionMifare RFID reader with GNET Plus protocol Pin
GerritdL2-Jul-09 1:43
GerritdL2-Jul-09 1:43 
AnswerRe: Mifare RFID reader with GNET Plus protocol Pin
Henry Minute2-Jul-09 2:17
Henry Minute2-Jul-09 2:17 
AnswerRe: Mifare RFID reader with GNET Plus protocol Pin
GerritdL6-Jul-09 20:17
GerritdL6-Jul-09 20:17 
GeneralRe: Mifare RFID reader with GNET Plus protocol Pin
Muhammad Yousuf Maher16-Jul-14 3:04
Muhammad Yousuf Maher16-Jul-14 3:04 
Questionexception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 1:23
Harry6662-Jul-09 1:23 
Hello there,

I am programming C# using MS Visual Studio Professional Edition 2008 and MS Office Excel 2007.
My Problem is that I want to mark a range, copy and insert it at the same position shifting existing cells down. I can do this with the Excel GUI - no problem. But programmatically I get a System.Runtime.InteropServices.COMException, telling me that the Insert-method of the Range-object could not be executed (German text:"Die Insert Methode des Range-Objektes konnte nicht ausgeführt werden.").

The range I want to copy has got some special formats (font, color, some merged cells), and I need these for each entry I have to insert.

I am trying this code
<pre>
Excel.Worksheet sheet = (Excel.Worksheet)wb.Sheets["mySheet"]; // wb is the actual workbook
Excel.Range range = sheet.get_Range(sheet.Cells[16, 1], sheet.Cells[18, 37]);// this is "A16:AK18"
range.Insert(Excel.XlInsertShiftDirection.xlShiftDown, range);
</pre>

Here come the questions:
Why can I not insert the range? What are possible reasons?
How can I insert the desired range?

Thanks in anticipation!
Harry

no plan,
no signature

AnswerRe: exception trying to insert a range to an Excelsheet Pin
padmanabhan N2-Jul-09 1:44
padmanabhan N2-Jul-09 1:44 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 5:04
Harry6662-Jul-09 5:04 
AnswerRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 1:47
MumbleB2-Jul-09 1:47 
AnswerRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 1:57
MumbleB2-Jul-09 1:57 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 3:33
Harry6662-Jul-09 3:33 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 4:00
Harry6662-Jul-09 4:00 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 9:22
MumbleB2-Jul-09 9:22 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6662-Jul-09 13:58
Harry6662-Jul-09 13:58 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
MumbleB2-Jul-09 22:14
MumbleB2-Jul-09 22:14 
GeneralRe: exception trying to insert a range to an Excelsheet Pin
Harry6664-Jul-09 0:57
Harry6664-Jul-09 0:57 
Generalstill trying to insert a range to an Excelsheet Pin
Harry6664-Jul-09 4:14
Harry6664-Jul-09 4:14 
GeneralRe: still trying to insert a range to an Excelsheet Pin
MumbleB4-Jul-09 8:31
MumbleB4-Jul-09 8:31 
GeneralRe: still trying to insert a range to an Excelsheet Pin
Harry6665-Jul-09 4:38
Harry6665-Jul-09 4:38 
GeneralUsing a makro Pin
Harry6665-Jul-09 6:04
Harry6665-Jul-09 6:04 
GeneralRe: still trying to insert a range to an Excelsheet Pin
MumbleB6-Jul-09 19:16
MumbleB6-Jul-09 19:16 
GeneralRe: still trying to insert a range to an Excelsheet Pin
Harry6669-Jul-09 3:32
Harry6669-Jul-09 3:32 
QuestionDowloading file, web aplication and C# Pin
hoshyarD2-Jul-09 0:34
hoshyarD2-Jul-09 0:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.