How to open up Excel Workbook from a button click selection

I have posted code below that will open up the Excel Spreadsheet however I can;t seem to figure out how to open up an individual workbook for selection.

Thanks
Private Sub btnXYZFile_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXYZFile_Open.Click
        Dim XlFilePath As String
        Me.dlgOpenPartfile.InitialDirectory = _Default_Definition_FileOpen_Dir
        If Me.dlgOpenPartfile.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then
            '  Opens the target Excel File
            Dim ExcelObj As New Microsoft.Office.Interop.Excel.Application
            ExcelObj.Visible = True

        End If
    End Sub

Open in new window

cmdolcetAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Jacques Bourgeois (James Burger)Connect With a Mentor PresidentCommented:
Code Cruiser told you how to get the value. You can use it this way:

ExcelObj.WorkBooks.Open(dlgOpenPartfile.FileName)
0
 
CodeCruiserCommented:
Not sure what you mean. Do you want to open an Excel file in Excel? Use Process.Start("path of xls file")
0
 
cmdolcetAuthor Commented:
how do I get that path. I can open up a selection window in the code above the Excel Object but when I select the File in the folder the workbook doesn;t open
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
CodeCruiserCommented:
The path will be Me.dlgOpenPartfile.FileName property.
0
 
cmdolcetAuthor Commented:
How can I capture the value selected ?
0
 
cmdolcetAuthor Commented:
opps I didn't read that carefully
0
All Courses

From novice to tech pro — start learning today.