Delete worksheet from an excel - VB.Net
By default, Excel provides three worksheets in a workbook, but you can add new worksheets or delete worksheets as needed programmatically from VB.Net application. In order to delete a worksheet, you must add a reference to the Microsoft.Office.Interop.Excel assembly, and then you must use classes from that assembly to open a workbook and delete a worksheet.The following VB.Net program shows how to delete worksheet from an an existing Excel file.
To access the object model from Visual VB.Net, you have to add the Microsoft Excel 12.0 Object Library to you project. In the previous chapter you can see a step by step instruction on how to add Excel library to your project.
Delete worksheet from an excel file
In order to delete worksheet from excel file, this VB.Net program open an existing Excel file and select the worksheet and then delete it.
Delete Excel.Worksheet without prompts
DisplayAlerts set to False for suppress prompts and alert messages while a macro is running. When a message need a response from the user side, Microsoft Excel chooses the default response. After you finish the running process, Microsoft Excel sets this property to True, unless you are running cross-process code.
The following VB.Net source code shows how to programmatically delete Worksheets from Workbooks.
- How to create an Excel file in VB.NET
- How to open or read an existing Excel file in VB.NET
- How to read an Excel file using VB.Net
- Add new worksheet in Excel file - VB.Net
- How to Format Excel Page in VB.NET
- How to insert a Picture in Excel through programing on VB.NET
- How to insert a background Picture in Excel through VB.NET
- How to create a Chart in Excel in VB.NET
- How to export a Chart in Excel as Picture file from VB.NET
- How to Excel Chart in VB.NET Picture Box
- How to Excel DataBar in VB.NET
- How to Excel Data Validation Input Message
- Read and Import Excel File into DataSet or DataTable in vb.net
- How to insert cell data in an Excel file using OLEDB
- How to update cell data in an Excel file using OLEDB
- How to export from database to excel
- How to export from DataGridView to excel