Quote Originally Posted by MOS MASTER
Hi Howard,

True; like I mentioned before I try to avoid the Selection Object as much as possible. Not only to gain on speed but it has brought me to strange results in the past.
Selection depends too much on various setting the user might be using in Tools | Options. To avoid such issues one has to initialize the envirinment with known settings for, anong others, whether typing replaces selection.

Off course it's always a good thing to experient with different approaches when you're programming a specific task. (there's almost always a tool that does the job the best)
Over time, one learns these things from seeing others posts.

There are general rules, but oh my there are exceptions as we recently learned reharding te ProofReadingErrors collection.

I was triggerd by you're call that the Range Object with the Expand method would be the fastes way to achieve this.
I've never used this object to do this perticular task so I tried it out..

I'm going to try it in the future on other jobs to see if it's speeding things up.
My experience has been that using Expand is the fastest wat to move thru a Selectio/Range, other things being equal.

I'll comment on Tony's case in a response to his reply.

I'm still wondering if anyone else got another approach on frying this chicken because it still seams to run a little bit slow. (on big documents with lot's of highlighting)
Dag nab it!
Now I have this urge to eat chicken and I've got none in the house!

Quote Originally Posted by TonyJollans
Hi Joost,

On your test document I found using Find consistently a little faster (perhaps 6 or 7%). When I did it originally I just ran a couple of quick tests with far fewer words highlighted and I saw a very noticeable difference without a need for a timer. I guess the gain (or otherwise) depends on what percentage of the document is highlighted.
For your app, Find will be faster than using Expand because Find has the built-in smarts to look for formatting, highlighting, etc.

With Exapand, one has to do the testing oneself.

As for using the Selection object, I do agree that it should be avoided in general but it is not always the case in Word. In my experience, Find is one of those things which often seems to work best with the Selection; there seem to be some oddities when trying to use it with other Range objects like it is in some way always tied to the Selection.
My experience has been that Selection.Find may be faster than Range.Find only when something must selected after being found.

I find the Range / Expand approach slightly convoluted in this case although there may be a way to use it effectively. I'm still thinking about other methods
For your app Find should be faster.