View Single Post
 
Old 03-14-2022, 05:26 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If there's a bookmark in table 4, the code can be simplified e.g as below, where I have also provided different options for each of the four tables if required.
Code:
If ActiveDocument.Tables.Count > 3 Then
        If ActiveDocument.Tables(4).Range.Bookmarks.Exists("bmName") = True Then
            For i = 1 To 4
                Set oTable = ActiveDocument.Tables(i)
                'Do something with otable e.g.
                Select Case i
                    Case Is = 1
                        oTable.Cell(1, 1).Range.Text = "Test"
                    Case Is = 2
                        oTable.Cell(1, 1).Range.Text = "Test2"
                    Case Is = 3
                        oTable.Cell(1, 1).Range.Text = "Test3"
                    Case Is = 4
                        oTable.Cell(1, 1).Range.Text = "Test4"
                End Select
            Next i
        End If
    End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote