I'm using for each loops to search thru some word tables to find enclosing bookmarks. There are several rows and several cells per row. Several cells have enclosing bookmarks, in the cell. As I loop thru the cells in a row I use a for each loop to look for bookmarks in the cell. I would expect each cell to "see" only it's bookmarks but all of the bookmarks in the row are selected one after the other. So if there are six cells in a row and only two cells have one bookmark each, I see each bookmark selected six times not once as I would expect.
Code:
For Each wRow In wTbl.Rows
For Each wCell In wRow.Cells
wCell.Select
wApp.Selection.Range.Collapse wdCollapseStart
For Each wBmk In wApp.Selection.Bookmarks
wBmk.Range.HighlightColorIndex = wdBlue
Sleep 150
wBmk.Range.HighlightColorIndex = wdNoHighlight
Sleep 150
Next
Next
Next
The highlighting is only for testing. How do I get only the cells with bookmarks and only the bookmark in that particular cell.