How to open excel applicatiion using VB.NET?

The package Microsoft.Office.Interop.Excel may not be available in the xaml by default. So, try importing the package from the manage packages then use the below code.

Here is the sample code …

    Dim excel As Microsoft.Office.Interop.Excel.Application
    Dim wb As Microsoft.Office.Interop.Excel.Workbook
    Dim ws As Microsoft.Office.Interop.Excel.Worksheet
     excel = New Microsoft.Office.Interop.Excel.Application 'create the instance of excel work book'

        wb = excel.Workbooks.Open(" Path to the file") 'Open the excel the file
        excel.Visible = True

        ws = CType(wb.Sheets("Sheet Name"), Microsoft.Office.Interop.Excel.Worksheet) 'select a sheet and activiates'
        ws.Activate()
1 Like