title: how to get the number of records in excel vba recordeset
body: <p>I want to get the total number of records in a record set using vba in excel, i used below code but it not running . maybe help me!</p>
  
  <pre><code> Set cn = CreateObject("ADODB.Connection")
      strConnection = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" &amp;   Application.ActiveWorkbook.Path &amp; "\infodb.mdb"
      cn.Open strConnection
  
  strSql = "SELECt * FROM tbl_hoze"
          Set rs = cn.Execute(strSql)
              rs.MoveLast
              MsgBox rs.RecordCount
  </code></pre>