I have used the Process.start function to open an Excel file as shown in the code

Process.Start("report.xlsx") and it works perfectly well.

My question is can this function be used to open a particular worksheet called Report1 in the report.xlsx file. If so what would the code be.

I have spent many hours trying to research this topic but without success.

Many Thanks for your help.

There have been several postings on this forum relating to accessing Excel spreadsheets from within VB. For example, I recently posted the following code which returns an array containg the names of all worksheets in a given workbook.

Private Function GetWorkSheetNames(ByVal ExcelFile As String) As String()
     
    Dim names As String = ""
    Dim xls As New Excel.Application
    xls.Workbooks.Open(ExcelFile)
     
    For Each sheet As Excel.Worksheet In xls.ActiveWorkbook.Worksheets
        names = names & vbCr & sheet.Name
    Next
     
    xls.Quit()
     
    Return names.Substring(1).Split(vbCr)
     
End Function

You should use the Excel methods rather than SendKeys. You can select a sheet my index (1-relative) or by name such as

sheet = xls.ActiveWorkbook.WorkSheets(3)
sheet = xls.ActiveWorkbook.WorkSheets("Sheet3")

Many thanks to all of you that answered my question. I now understand the Process.Start function better. Thankyou.

This question has already been answered. Start a new discussion instead.