Hi
I'm using this code to select text between two key phrases ;
Code:
Dim myrng As Range, endrng As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="MORE INFO ABOUT THE ITEM ", MatchCase:=True, Forward:=True, Wrap:=wdFindStop) = True
Set myrng = Selection.Range
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(findText:="ITEM NUM : ", MatchCase:=True, Forward:=True, Wrap:=wdFindStop) = True
Set endrng = Selection.Range
Loop
End With
myrng.End = endrng.End
myrng.Select
Unfortunately this only selects the first occurence and no others in the text. If there is more than one occurence the code selection spans whole tract of text.
I'd like it to select all of the specific occurences in the passage. If there are several times when the two inputs phrases can be found then it should find and select all occurences discretely.
Can someone advise with some modification or alternative code?
Grateful for any help.