I need to add formatting to the last line of the most nested table in a table in Word. The following code will find a nested table, but I need to do more than that. I need to check each table for nested tables. If that table has a nested table, I need to select that table. If that table has a nested table, I need that one instead. Then I need to add paragraph formatting to the last line.
The following is what I have so far, but it only looks for a level 1 nested table, not the most nested table in a table:
For Each mainTable In ActiveDocument.Tables
n = n + 1
NumOfTbl = NumOfTbl + 1
‘ Debug.Print “—— Table ” & n & ” ——”
‘nested level 1
ns = 0
For Each nestedTable1 In mainTable.Tables
nestedTable1.Rows.Last.Select
GetAllTablesInRange
‘MsgBox Selection.Tables.
Selection.Tables(1).Select
Selection.Tables(1).Rows.Last.Select
Selection.ParagraphFormat.SpaceAfter = 0
ns = ns + 1
NumOfTbl = NumOfTbl + 1
Next nestedTable1
Next mainTable
Thoughts?