Results 1 to 4 of 4

Thread: [RESOLVED] Error reading from Excel File.Please Help

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Resolved [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 HRESULT0x80028018 (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?

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    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)

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Error reading from Excel File.Please Help

    Moved to the VB.Net forum.

    This is a known issue.

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    2

    Re: Error reading from Excel File.Please Help

    Resolved by changeing my regional settings to United-States [english]
    Ty verry much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width