The selection range changes as soon as you find an instance so the loop will start from that new selection location and if that location is collapsed then that is where you start from and .Wrap isn't set in your code.
How much content is in the FRDoc file? This seems pretty inefficient to need to retrieve the search terms from there. Can you store that as a building block so it can be retrieved faster?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|