I want to let users reorder and delete sheets in an XLBookMBS. I put the sheets into the RowTags of a ListBox where the user can manipulate them, then on Save I make a new XLBookMBS and try to add the stored sheets into it with AddSheet. On the first pass through the loop newbook is ok, but on the second pass it has the error “index is out of range”. Tried it with InsertSheet and got the same result.
newbook = new XLBookMBS(True) newbook.SetKey(license) Dim sheet As XLSheetMBS for row As Integer = 0 to Listbox1.LastRowIndex sheet = Listbox1.RowTagAt(row) // Cast it call newbook.AddSheet(sheet.Name, sheet) // Second parameter is "InitSheet" for copying Next
Shouldn’t AddSheet perform an “append” operation, i.e. without regard to any index?