|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Opening an Excel file in VB.NET Hi all, How can I open ms Excel file in VB.net application. |
#2
| |||
| |||
Re: Opening an Excel file in VB.NET I hope this code will help you, Code: Dim excel As Microsoft.Office.Interop.Excel.Application Dim wb As Microsoft.Office.Interop.Excel.Workbook Try excel = New Microsoft.Office.Interop.Excel.Application wb = excel.Workbooks.Open("c:\\test.xls") excel.Visible = True wb.Activate() Catch ex As COMException MessageBox.Show("Error accessing Excel: " + ex.ToString()) Catch ex As Exception MessageBox.Show("Error: " + ex.ToString()) End Try |
#3
| |||
| |||
Re: Opening an Excel file in VB.NET I am not sure about it but you can try with this code. Code: 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 |
#4
| |||
| |||
Re: Opening an Excel file in VB.NET You can refer to this links for some more information about it, http://support.microsoft.com/kb/301982 http://support.microsoft.com/kb/302094 |
#5
| |||
| |||
Re: Opening an Excel file in VB.NET Don't use opaper's code. It's copied from another website and does NOT work. |
![]() |
|
Tags: excel in vb, open excel file |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Getting error when opening excel file using a VB script | Madri | Software Development | 4 | 18-07-2012 06:27 PM |
Getting Error while opening Microsoft Excel 2000 file in Excel 2003 | AbiaA | MS Office Support | 6 | 17-02-2012 01:18 PM |
Opening file type .tsv with Excel | Damned 2 | Windows Software | 5 | 12-01-2012 11:12 PM |
Opening WK1 File in Microsoft Excel 2007 | $horizon$ | Windows Software | 3 | 11-01-2012 06:07 PM |
Problem opening Excel file with VBA code | Lord | Software Development | 3 | 19-10-2009 09:50 AM |