H
Harish Sharma
Hi,
I have created a find macro to store all the text which are colored into a
list box as follows:
Sub FindColoredText()
Dim CURRENT_DOCUMENT As Range
Set CURRENT_DOCUMENT = ActiveDocument.Content
With CURRENT_DOCUMENT.Find
.ClearFormatting
.Font.Color = wdColorRed
Do While .Execute(findText:="", Forward:=True, Format:=True) = True
UserForm1.WhiteList.AddItem (.Parent)
DoEvents
Loop
End With
UserForm1.Show
End Sub
However, the problem is that this do loop is working on one particular
document but in another document it is going into infinite loop. I want to
ensure that the find loop starts from begening of the document and exits at
the end of the document.
I shall be thankful for all your help.
thanks,
I have created a find macro to store all the text which are colored into a
list box as follows:
Sub FindColoredText()
Dim CURRENT_DOCUMENT As Range
Set CURRENT_DOCUMENT = ActiveDocument.Content
With CURRENT_DOCUMENT.Find
.ClearFormatting
.Font.Color = wdColorRed
Do While .Execute(findText:="", Forward:=True, Format:=True) = True
UserForm1.WhiteList.AddItem (.Parent)
DoEvents
Loop
End With
UserForm1.Show
End Sub
However, the problem is that this do loop is working on one particular
document but in another document it is going into infinite loop. I want to
ensure that the find loop starts from begening of the document and exits at
the end of the document.
I shall be thankful for all your help.
thanks,