title: How to iterate through word table with unequal rows and columns with Excel VBA?
body: <p>I'm trying to import a Word table in Excel using VBA. I have some code but I am having a problem iterating through the table as it has unequal rows and columns. </p>
  
  <p>Here's my code so far:</p>
  
  <pre><code>Sub ImportWordTable()
      
      Dim wdDoc As Object
      Dim wdTable As Object
      Dim Word_Document_Name As Variant
      Dim TableNo As Integer
      Dim TableIndex As Integer    
  
      Word_Document_Name = Application.GetOpenFilename("Word files,*.doc;*.docx", , "Browse for Word File")
  
      If Word_Document_Name = False Then Exit Sub 'In case user hit the cancel button
  
      Set wdDoc = GetObject(Word_Document_Name) 'open Word file (Step takes time to open Word Document and inspect)
  
      With wdDoc
  
      TableNo = wdDoc.Tables.Count
  
      If TableNo = 0 Then MsgBox "This document contains no tables": Exit Sub
  
      For TableIndex = 1 To TableNo
  
              With .Tables(TableIndex)
  
                  For TableRow = 1 To .Rows.Count
  
                   &lt; SOME CODE HERE TO FIND NO. OF COLUMNS IN EACH ROW&gt;
  
                  Next                
  
              End With
              Next TableIndex
      End With
  End Sub
  </code></pre>
  
  <p>How can I traverse through the unequal table and get each of its cells content?</p>