Adding a second EXcel worksheet via RRS feed

  • Question

  • I am looking for an example adding a second worksheet to an Excel Workbook using
    Monday, January 27, 2020 2:56 PM

All replies

  • Hi,

    Here's a sample:
    Dim xlApp As New Microsoft.Office.Interop.Excel.Application
    Dim xlSht As New Microsoft.Office.Interop.Excel.Worksheet
    ' ---
    With xlApp
    	.Workbooks.Open("G:\Excel files\Book1.xlsx")
    	.ActiveSheet.Name = "New Sheet"
    End With
    ' --- 
    xlApp.Visible = True
    You need to add an Excel Object Library in your project - [References]:
    The left side of a screenshot:

    The right side of a screenshot:


    Ashidacchi --

    • Edited by Ashidacchi Tuesday, January 28, 2020 12:02 AM
    Monday, January 27, 2020 11:54 PM