J
Jerry
I have a macro (pasted below) that searches for any
occurance of 2 styles in a row. In this case the
style "term". It then highlights the ones that it finds so
ic an easily spot it. The problem being is that when the
last style in the document is "term", the macro does not
stop. I am sure I am missing something basic here.
Thanks for your help
Sub XMLDoubleTerm()
Dim oRng As Range
With Selection
.HomeKey Unit:=wdStory
With .Find
.text = ""
.Style = "term"
Do While .Execute
Set oRng = Selection.Range
With oRng
Do Until .Paragraphs.Last.Range.Style
<> "term"
.MoveEnd Unit:=wdParagraph, Count:=1
Loop
.MoveEnd Unit:=wdParagraph, Count:=-1
If .Paragraphs.Count > 1 Then
.HighlightColorIndex = wdYellow
End If
End With
Loop
End With
End With
End Sub
occurance of 2 styles in a row. In this case the
style "term". It then highlights the ones that it finds so
ic an easily spot it. The problem being is that when the
last style in the document is "term", the macro does not
stop. I am sure I am missing something basic here.
Thanks for your help
Sub XMLDoubleTerm()
Dim oRng As Range
With Selection
.HomeKey Unit:=wdStory
With .Find
.text = ""
.Style = "term"
Do While .Execute
Set oRng = Selection.Range
With oRng
Do Until .Paragraphs.Last.Range.Style
<> "term"
.MoveEnd Unit:=wdParagraph, Count:=1
Loop
.MoveEnd Unit:=wdParagraph, Count:=-1
If .Paragraphs.Count > 1 Then
.HighlightColorIndex = wdYellow
End If
End With
Loop
End With
End With
End Sub