Huber57 said:
All,
I have a 600 page document and there are changes scattered through
out it. 'Track Changes' is on so these changes are highlighted in a
different color. I would like to be able to 'find' works when I
search the document (using the Find function). Is there a way to
limit the search to strings that are changed?
Sincerely,
Doug
The fact that the changes are highlighted in color doesn't do you any good
at all, because there's no way to look for that (it isn't really font
formatting, just something the Track Changes feature applies).
The following macro will look through the changes (except the deletions) to
find the next occurrence of specified text. It completely ignores formatting
(bold, italic, etc.) -- it would take a fair bit more programming to handle
that.
Read
http://www.gmayor.com/installing_macro.htm if needed.
Sub FindInTrackedChanges()
Dim FindWhat As String
Dim oRev As Revision
Dim oRg As Range
Dim pos As Long
Dim foundOne As Boolean
Dim i
' set a range from the end of the selection
' to the end of the document
Set oRg = ActiveDocument.Range
oRg.Start = Selection.End
' get the search term
FindWhat = InputBox("Enter text to find:", "Find In Changes")
If Len(FindWhat) = 0 Then Exit Sub
' look through all tracked changes except deletions
For i = 1 To oRg.Revisions.Count
Set oRev = oRg.Revisions(i)
If oRev.Type <> wdRevisionDelete Then
pos = InStr(oRev.Range.Text, FindWhat)
If pos > 0 Then
foundOne = True
' move the selection to the search term
Selection.Start = oRev.Range.Start + pos - 1
Selection.End = Selection.Start + Len(FindWhat)
Exit For
End If
End If
Next
If Not foundOne Then
MsgBox "No more occurrences.", , "Find In Changes"
End If
End Sub
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.