View Single Post
 
Old 09-13-2025, 05:00 AM
chrisjj chrisjj is offline Windows 7 64bit Office 97-2003
Competent Performer
 
Join Date: Aug 2025
Posts: 120
chrisjj is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Alternatively, you could use:
Code:
Sub Demo()
Dim Tbl As Table, Cll As Cell
For Each Tbl In ActiveDocument.Tables
  With Tbl
    For Each Cll In .Range.Cells
      With Cll.Range
        If .Cells(1).Tables.Count > 0 Then
          With .Cells(1).Tables(1).Range
            MsgBox .Text
            .End = .End - 2: .Start = .Characters.Last.Cells(1).Range.Start
            MsgBox .Text
          End With
        End If
      End With
    Next
  End With
Next
End Sub
which works even if there is other content in the parent cell.
On



that gives



which looks incorrect to me.
Reply With Quote