Add new worksheet in Excel file
Adding new worksheets and setting which sheet is active are common and simple tasks that programmers need to know how to perform. The following program shows how to add a new worksheet to an existing Excel file and active the selected worksheet using VB.Net Application.
To access the object model from 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.How to add Excel Library
Programmatically Add New Worksheets to Excel
In order to add new worksheet to the excel file, this VB.Net program open an existing Excel file and add a new worksheet in the existing workbook.
Disable Excel overwrite promt - VB.Net
DisplayAlerts set to False for suppress prompts and alert messages while a macro is running. When a message need a response from the end user, Excel chooses the default response. After you finish the running process, Excel sets this property to True, unless you are running cross-process code.
Programmatically Select Worksheets - VB.Net
You can Programmatically select Worksheet and set focus on that worksheet when user open the Excel file.
Above method shows how to select (focus) a specified worksheet, in this way you can select any existing worksheet from an Excel document.
Finally, we have to properly clean up Excel interop objects or release Excel COM objects after your program over. Here using a function releaseObject() to clean up the Excel object properly.
The following VB.Net source code shows how to insert new worksheet in an excel file