1
我有這樣的代碼讀取Excel文件錯誤讀取Excel中使用VB.NET
Dim scheduleFileName As String
'Creating Excel Object
Dim fileName As String
fileName = "E:\Vb Deployment\scheduling\scheduleSheet.xlsx"
Dim objExcel As New Excel._ExcelApplication
Dim objWrkBk As Excel.Workbook
Dim objSht As Excel.Worksheet
Dim testdata As String
objWrkBk = GetObject(fileName)
' or objWrkBk = objExcel.Workbooks.Open("C:\test.xls")
objSht = objWrkBk.Worksheets(0)
testdata = objSht.Cells(1, 1).Value.ToString()
但它給在錯誤上線
objSht = objWrkBk.Worksheets(0)
錯誤:未找到成員....
您能否讓我知道爲什麼我得到這個錯誤以及如何糾正它?