1,先添加excel的引用,然后添加如下代码:
Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop
Imports Microsoft.Office
2,添加一个button空间,添加如下代码:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xlapp As New Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
xlbook = xlapp.Workbooks.Open("c:\1.xls")
xlsheet = xlbook.Worksheets(0)
Console.WriteLine(xlsheet.Cells(1, 1).text)
xlbook = Nothing
xlapp.Quit()
End Sub
到此,应该就能读取了。