Something like that should do the job ;)
Private Sub btnMinSummaryWorksheet_Click(sender As Object, e As EventArgs) Handles btnMinSummaryWorksheet.Click
Dim xlApp As Excel.Application
Try
xlApp = CType(GetObject(, "Excel.Application"), Application)
Catch ex As Exception
xlApp = New Excel.Application
End Try
Dim xlBook As Excel.Workbook
Dim xlWBName As String = "2011.1004.Compensation Template"
xlApp.Visible = True
Try
xlBook = xlApp.Workbooks(xlWBName & ".xlsx")
Catch ex As Exception
xlBook = xlApp.Workbooks.Open("F:\Test Environment\Compensation Workbook\Compensation Workbook\bin\Debug\" & xlWBName & ".xlsx")
End Try
Dim xlSheet As Excel.Worksheet
xlSheet = CType(xlBook.Sheets("SummaryWorksheet"), Worksheet)
xlSheet.Activate()
End Sub
Another way is to iterate through the collection of Workbooks ;)