title: Excel vba incluse headers in the result when retriving excel data with ado using where in SQL
body: <p>I know that I must set HDR=NO so the headers to be included in the results. But when I set it I cannot use the where in the SQL statement. Any ideas how to fix it;</p>
  
  <pre><code>Sub adoExcel()
  
  Set objConnection = CreateObject("ADODB.Connection")
  Set objrecordset = CreateObject("ADODB.Recordset")
  
  '*************************************************************************************
  objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
  "Data Source=C:\Users\sp\Desktop\test ado excel\test.xls;" &amp; _
  "Extended Properties=""Excel 8.0;HDR=No;IMEX=1"";"
  '*************************************************************************************
  'where Number =2
  objrecordset.Open "Select * FROM [Sheet1$] where Number =1", _
  objConnection, adOpenStatic, adLockOptimistic, adCmdText
  
  ActiveSheet.Cells(2, 1).CopyFromRecordset objrecordset
  
  '*************************************************************************************
  ' Loop through the recordset and send data to the Immediate Window
  '**************************************************************************************
  'objrecordset.MoveFirst
  
  'Do
     ' Debug.Print objrecordset![Name] &amp; " " &amp; objrecordset![Number]
     ' objrecordset.MoveNext
  'Loop Until objrecordset.EOF
  
  '**************************************************************************************
  'ActiveSheet.Cells(1, 1).CopyFromRecordset objrecordset![Name] &amp; " " &amp; objrecordset![Number]
  '*************************************
  End Sub
  </code></pre>