Subject: Create Workbook with One Worksheet
Date: 2019-02-01 18:46:52
From: iokevins
Source: remove-worksheets-range-workbook
----------------------------------------------------------------------

How might I efficiently remove the unused second and third worksheets from a new Workbook?

These seem created each time I add a Workbook using:

    Dim ReportWorkbook As Workbook = New WorkbookManager().Workbooks.Add(ExcelVersion.Excel2013)

Alternatively, how might I specify I want just one worksheet when creating the workbook?

What I've tried:

Using ComponentPro v7.0.226.56 and Microsoft Visual Studio Professional 2017 Web Forms project (VB.net):

    ReportWorkbook.Worksheets(2).Remove()
    ReportWorkbook.Worksheets(1).Remove()

Note: removing last-to-first to avoid index out-of-range errors.

I've looked at WorksheetCollection but that doesn't seem to have member functions to remove Worksheet ranges.

Thank you

----------------------------------------------------------------------

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