I'm having a problem importing from an excel spreadsheet. The code I am using is as follows:
Function ImportFromExcel(ByVal strPath As String)
Dim tmpDS As New DataSet
Dim tmpAdapter As OleDbDataAdapter
Dim tmpCon As OleDbConnection
'Creates the OleDB connection
tmpCon = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & strPath & "; " & _
"Extended Properties=Excel 10.0;")
'Creates and fills the data adapeter, importing all the excel information
tmpAdapter = New OleDbDataAdapter("select * from [sheet2]", tmpCon)
On Error GoTo ErrHandle
Call tmpAdapter.Fill(tmpDS)
tmpCon.Close()
Return tmpAdapter
errhandle:
MsgBox(Err.Number & ": " & Err.Description)
End Function
The problem arises here:
Call tmpadapter.Fill(tmpDS)
It gives me error #5, Could not find installable ISAM
Any ideas on what this means???
Function ImportFromExcel(ByVal strPath As String)
Dim tmpDS As New DataSet
Dim tmpAdapter As OleDbDataAdapter
Dim tmpCon As OleDbConnection
'Creates the OleDB connection
tmpCon = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=" & strPath & "; " & _
"Extended Properties=Excel 10.0;")
'Creates and fills the data adapeter, importing all the excel information
tmpAdapter = New OleDbDataAdapter("select * from [sheet2]", tmpCon)
On Error GoTo ErrHandle
Call tmpAdapter.Fill(tmpDS)
tmpCon.Close()
Return tmpAdapter
errhandle:
MsgBox(Err.Number & ": " & Err.Description)
End Function
The problem arises here:
Call tmpadapter.Fill(tmpDS)
It gives me error #5, Could not find installable ISAM
Any ideas on what this means???