Empty Nest(ed) Tables

I had a large document with many, many tables.  I needed to make sure that none of the tables contained any sub-tables.  Macros to the rescue!


Sub removeNestedTables()

‘ removeNestedTables Macro


    Dim myTable As Table
    Dim subTable As Table
   
    Dim ttCell As Word.Cell
   
    For Each myTable In ActiveDocument.Tables
        For Each ttCell In myTable.Range.Cells
            If ttCell.Tables.Count > 0 Then
                For Each subTable In ttCell.Tables
                    subTable.ConvertToText Separator:=”, “
                Next subTable
            End If
        Next ttCell
    Next myTable
End Sub