[RESOLVED] Error reading from Excel File.Please Help
I'm trying to read from an excel worksheet and i'm receveing this error code :
PHP Code:
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
Code:
Imports Excel = Microsoft.Office.Interop.Excel
Public Class test
Dim xlApp As New Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
Dim ala(0 To 100) As String
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
xlWorkBook = xlApp.Workbooks.Add
xlApp.Visible = True
xlWorkSheet = xlWorkBook.Sheets("Sheet1")
With xlWorkSheet
ala(1) = .Range("A1").Value
ala(2) = .Range("A2").Value
ala(3) = .Range("A3").Value
ala(4) = .Range("A4").Value
ala(5) = .Range("A5").Value
End With
For i = 1 To 5
ListBox1.Items.Add(ala(i))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
xlWorkBook = xlApp.Workbooks.Open("C:\Documents and Settings\cretzu1\Desktop\New Microsoft Office Excel Worksheet.xlsx")
xlApp.Visible = True
End Sub
End Class
How can i resolve it? :(
Re: Error reading from Excel File.Please Help
What Reference did you add to your project?
\
(If this is a VB.NET project, wrong Forum....this is for VB6 and Earlier)
Re: Error reading from Excel File.Please Help
Moved to the VB.Net forum.
This is a known issue.
Re: Error reading from Excel File.Please Help
Resolved by changeing my regional settings to United-States [english]
Ty verry much :)