View Single Post
 
Old 01-16-2020, 02:57 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Word does consider nested tables to be tables, the problem is just that the nested tables are contained inside other tables. For instance, to get to the first level of nesting
Code:
Sub TestTables()
  Dim aTbl As Table, aTblN As Table
  For Each aTbl In ActiveDocument.Tables
    Debug.Print aTbl.NestingLevel
    For Each aTblN In aTbl.Tables
      Debug.Print aTbl.NestingLevel, aTblN.NestingLevel
    Next aTblN
  Next aTbl
End Sub
The next trick is to come up with a recursive function so that you can drill into deeper nesting levels. This thread vba - Find/Count all tables in the document's body (including all nested tables of all levels) - Stack Overflow has more inspiration for you.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote