Adding worksheets
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 ; )
|