So this is the VB forum
As my post's title indicates, I wanna read all cells of all sheets/pages in my excel file and just show the text content of each cell.
I have written my code but have 2 problems:
1. How can I read cells inside the While?
2. My select command only selects Sheet1, how can I select ALL sheets?
Thank you guys/gals, as I am not expert in database.
As my post's title indicates, I wanna read all cells of all sheets/pages in my excel file and just show the text content of each cell.
I have written my code but have 2 problems:
Visual Basic:
Dim ExcelConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Excel.xls;Extended Properties=Excel 8.0;")
ExcelConnection.Open()
Dim MyCommands As New OleDbCommand("SELECT * FROM [Sheet1$]", ExcelConnection)
Dim MyReader As OleDbDataReader = MyCommands.ExecuteReader
While MyReader.Read()
'How should I read cells here?
End While
MyReader.Close()
ExcelConnection.Close()
2. My select command only selects Sheet1, how can I select ALL sheets?
Thank you guys/gals, as I am not expert in database.