Thanks for the reply, though I could not convert your code without errors. I did get this code below to run, but it has a very strange problem. It will only work if I do not save the project. Once I save the project, I get an error:
"Request for the permission of type 'System.Data.OleDb.OleDbPermission....' failed"
If I copy and paste the entire code into a new project, it works again! This is the most bizarre bug I have seen in awhile.
// EDIT
Found a setting in .NET Framework where you can increase trust level of 'Local Intranet'. This needed to be done since the excel file resided on a networked drive.
// End EDIT
Dim sqlConnection As New System.Data.OleDb.OleDbConnection
Dim sqlDataAdapter As New System.Data.OleDb.OleDbDataAdapter("SELECT * FROM [JOBS$]", sqlConnection)
Dim sqlDataSet As DataSet = New DataSet
Dim sqlDataRow As DataRow
sqlConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Brian\WIP\BrianWIPLIST.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"""
sqlDataAdapter.Fill(sqlDataSet)
For Each sqlDataRow In sqlDataSet.Tables(0).Rows
If IsNumeric(sqlDataRow("JOB #")) Then MsgBox(sqlDataRow("JOB #"))
Next
sqlConnection.Close()
Enter your message below
Sign in or Join us (it's free).