When you record code it relies heavily on the selection object (what is currently selected). The Find dialog behaves differently with a selection vs an insertion point. If there is a selection of some text when you run a find, it only searches inside the selected text. However if the selection is collapsed, the search will either search across the whole document or down to the bottom or up to the top depending on your other settings.
Your code (as recorded) moves the selection object so subsequent searches start from different places and may indeed start with a selected range.
If you keep the above info in your mind, stepping through your code will show you why your later searches fail to find the instances you seek. Paul's code avoids moving the selection object and hence is unaffected by those other factors.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
|