Subject: Clearing Worksheets Collection Date: 2018-04-25 18:58:28 From: rblanchard66 Source: clearing-worksheets-collection ---------------------------------------------------------------------- After I create a Workbook object I immediately clear the worksheets to get rid of any default worksheets. Workbook.Worksheets.Clear() I then run my code that will add one or more new sheets. When I attempt to save my workbook I am getting the following error. I have played with ActiveSheets and ActiveSheetsIndex and it looks like even though I cleared my worksheets the Workbook still thinks the ActiveSheet is "Sheet1". I have tried calling SetActiveSheet after adding new woksheets with the same result. Is this a bug or something I am dpoing wrong? .NET Stack Trace: [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.Excel2007Serializator.SerializeWorksheet(XmlWriter writer, Worksheet sheet, Stream streamStart, Stream streamConFormats, Dictionary`2 hashXFIndexes) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.WorksheetDataHolder.SerializeWorksheetPart(Worksheet sheet, Dictionary`2 hashNewXFIndexes) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.WorksheetDataHolder.SerializeWorksheet(Worksheet sheet, Dictionary`2 hashNewXFIndexes, Dictionary`2 cacheFiles) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveWorksheet(Worksheet sheet, String itemName, Dictionary`2 hashNewXFIndexes, Dictionary`2 cacheFiles) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveSheet(BaseSheet sheet, String itemName, RelationCollection relations, String workbookPath, Dictionary`2 hashNewXFIndexes, Dictionary`2 cacheFiles) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveSheets(RelationCollection relations, String workbookItemName, Dictionary`2 hashNewXFIndexes, Dictionary`2 cacheFiles) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveWorkbookPart(Dictionary`2 hashNewXFIndexes, Dictionary`2 cacheFiles) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveWorkbook(FileSaveType saveAsType) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveDocument(FileSaveType saveType) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveDocument(Stream stream, FileSaveType saveType) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.XmlSerialization.FileDataHolder.SaveDocument(String filename, FileSaveType saveType) [18/04/25@14:55:12.662-0400] P-007412 T-018456 1 4GL ORS_ERR at ComponentPro.Excel.Workbook.SaveAs(String FileName, FileSaveType saveType, ExcelVersion version) ---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index