![]() |
#4
|
||||
|
||||
![]()
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 |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Remove Paras with Line Spac 6; Macro to Convert Paragraphs to Outline Numbered | venganewt | Word VBA | 0 | 01-25-2022 06:28 PM |
Calling macro from loop-all-files macro only opens one file | Peterson | Word VBA | 0 | 03-27-2021 07:58 PM |
![]() |
Le_Blanc | Word VBA | 10 | 03-22-2021 11:38 AM |
Spell check macro within macro button field doesn't work in one document | samuelle | Word VBA | 0 | 07-20-2016 02:27 AM |
![]() |
LadyAna | Word | 1 | 12-06-2014 10:39 PM |