Excel dosyasını okuma


Sub ReadXLSFile()
    Dim excelApp, Wb1, Sh1, i, col1Value, col2Value, col3Value
    Set excelApp = CreateObject("Excel.Application")
    Set Wb1 = excelApp.Workbooks.Open("c:\book1.xls")
    Set Sh1 = Wb1.Sheets(1)  'or .Sheets("Sheet1")
    
    For i = 1 To 25000
        If Sh1.Cells(i, 1).Value = "" Then Exit For
        col1Value = Sh1.Cells(i, 1)   'Sh1.Cells(row,column).Value
        col2Value = Sh1.Cells(i, 2)
        col3Value = Sh1.Cells(i, 3)
    Next
    Wb1.Close
    excelApp.Quit
End Sub