Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, I guess this is kind of basic stuff, but I would be very
pleased if you could help me anyway. Im trying to add a number of sheets to a workbook in vsto (c#). I use a list to add several sheets. the interesting code is pretty much: List<Excel.Worksheet ws; ws = new List<Excel.Worksheet(); for (int i = 0; i <= theend; i++) { ws.Add((Excel.Worksheet)Globals.ThisWorkbook.Works heets.Add(missing, missing, missing, missing)); //a lot of code after this: } This work the first time in the loop, the other time though I get an ArgumentOutOfRangeException when it hits any of the ws objects. I may have done this completely wrong, but Im new with this so have patience plz ; ) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
new is object oriented code to create a new class (object). The new
sttatement assigns memory space for the class. You can't add moe than one item to the object because there isn't enough memory. There isn't enough code to tell what you are doing to give suggestions. " wrote: Hello, I guess this is kind of basic stuff, but I would be very pleased if you could help me anyway. Im trying to add a number of sheets to a workbook in vsto (c#). I use a list to add several sheets. the interesting code is pretty much: List<Excel.Worksheet ws; ws = new List<Excel.Worksheet(); for (int i = 0; i <= theend; i++) { ws.Add((Excel.Worksheet)Globals.ThisWorkbook.Works heets.Add(missing, missing, missing, missing)); //a lot of code after this: } This work the first time in the loop, the other time though I get an ArgumentOutOfRangeException when it hits any of the ws objects. I may have done this completely wrong, but Im new with this so have patience plz ; ) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding Across WorkSheets | Excel Worksheet Functions | |||
adding worksheets | Excel Discussion (Misc queries) | |||
adding worksheets together | Excel Discussion (Misc queries) | |||
Adding worksheets | Excel Programming | |||
Adding Worksheets | Excel Programming |