How to retrieve data from Excel with ADODB connection if the first line of the worksheet does not have the column name?
问题 I use the following type of code to retrieve data from some Excel Workbooks (path is a Parameter) Dim strSQL As String, conStr as String Dim cnn As New ADODB.Connection Dim rs As New ADODB.Recordset conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & path & "';" & _ "Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;"";" strSQL = "SELECT [Field1], [Field2] FROM [Worksheet$] WHERE [Thing1] > 1" cnn.open conStr rs.Open query, cnn, adOpenStatic, adLockOptimistic, adCmdText That code works