472,146 Members | 1,266 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Open existing Excel in VB.NET

It's got to be simple, but there doesn't seem to be
an "open" method for opening an existing Excel
spreadsheet in a VB.Net. What do I do after the following?

Dim myExcel As Excel.ApplicationClass
Dim myWrkBk As Excel.Workbook()
Dim xcFileInfo As IO.FileInfo
Dim xcFileDialog As New OpenFileDialog()

xcFileDialog.Filter = "Excel Spreadsheet Files!
|*.xls"
xcFileDialog.Title = "Select estimate in excel
spreadsheet file!"
If xcFileDialog.ShowDialog = DialogResult.OK Then
xcFileInfo = New IO.FileInfo
(xcFileDialog.FileName)
myExcel = CreateObject("Excel.Application")
End If

Nov 20 '05 #1
1 29719
myExcel.Workbooks.Open(m_strPath & "\Work.xls")

"Joe Cletcher" <cl********@ornl.gov> wrote in message
news:01****************************@phx.gbl...
It's got to be simple, but there doesn't seem to be
an "open" method for opening an existing Excel
spreadsheet in a VB.Net. What do I do after the following?

Dim myExcel As Excel.ApplicationClass
Dim myWrkBk As Excel.Workbook()
Dim xcFileInfo As IO.FileInfo
Dim xcFileDialog As New OpenFileDialog()

xcFileDialog.Filter = "Excel Spreadsheet Files!
|*.xls"
xcFileDialog.Title = "Select estimate in excel
spreadsheet file!"
If xcFileDialog.ShowDialog = DialogResult.OK Then
xcFileInfo = New IO.FileInfo
(xcFileDialog.FileName)
myExcel = CreateObject("Excel.Application")
End If

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
reply views Thread by kennedystephen | last post: by
9 posts views Thread by Looch | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.