Quote:
Originally Posted by Guessed
FindStop does indeed stop at the end of the document. However, if the previous find has moved the range to somewhere down the document, lets assume the middle, then the NEXT find will start from there and only search to the end (hence not checking above the current range position). If any find gets a hit at the end of the file then every subsequent find will have nowhere to search.
Your choices are to reset the range before each find or simply get it to continue so that every search is performed on the entire document.
|
The code I posted is unaffected by whatever point you're trying to make. You can demonstrate this quite easily by creating a 1-column table with, say, four rows, and numbering each cell as 4, 3, 2, 1, respectively, then running the code below (modified from post #9 above). All four numbers will be processed and turned blue.
Code:
Sub Demo1()
Application.ScreenUpdating = False
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
With Tbl.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Replacement.Font.Color = wdColorBlue
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Replacement.Text = "^&"
.Text = "1"
.Execute Replace:=wdReplaceAll
.Text = "2"
.Execute Replace:=wdReplaceAll
.Text = "3"
.Execute Replace:=wdReplaceAll
.Text = "4"
.Execute Replace:=wdReplaceAll
End With
Next Tbl
Application.ScreenUpdating = True
End Sub