Hi,

I am trying to load an excel file from vb.net. this is all new to me and I have tried this code :

VB Code:
  1. Private Sub MenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
  2.         Dim xlbook As Microsoft.Office.Interop.Excel.Application = New Excel.Workbook
  3.         Dim wb As Microsoft.Office.Interop.Excel.Workbook
  4.         Dim filestring As String = ("C:\My Documents\VBA")
  5.         Try
  6.             xlbook = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
  7.  
  8.             wb = xlbook.Workbooks.Open(filestring & "\trial vba.xls")
  9.  
  10.             xlbook.Visible = True
  11.             'wb.Activate()
  12.         Catch ex As Exception
  13.             MessageBox.Show("Error: " + ex.ToString())
  14.         End Try
  15.  
  16.     End Sub

Can someone please help.

I also need to load the file in a datagrid but I dont know how to do this since I always loaded Access database table. Please give me some examples. Thanks.