title: Counting the number of tables in a Word document
body: <p>I have a Word document with many tables.</p>
  
  <p>I need to count the number of tables.</p>
  
  <p>I have tried the following VBA</p>
  
  <pre><code>Dim T as Table
  Dim i as Integer
  Dim Tables as Integer
  
  For Each T In wdDoc.Tables
      i = i + 1
      Exit For
  Next
  Tables = i
  End sub
  </code></pre>
  
  <p>However this comes back with</p>
  
  <blockquote>
    <p>"Run-time error '424': Object required".</p>
  </blockquote>
  
  <p>I also found on the internet the code</p>
  
  <pre><code>Tables = wdDoc.Tables.Count
  </code></pre>
  
  <p>Creating a macro with this code doesn't seem to do anything.</p>