Optimizing Searching in Word

E

Evan Stone

I'm doing quite a bit of searching and replacing using the Find.Execute
method, and I was wondering if there were any recommended ways of optimizing
the process.

For instance, can I turn off the redraw/refreshing on the document until I'm
finished (or hide it entirely).

I'm just wondering what the Best Practice would be in this scenario.

Many Thanks in Advance!

evan stone | software engineer
 
C

Cindy M -WordMVP-

Hi Evan,
I'm doing quite a bit of searching and replacing using the Find.Execute
method, and I was wondering if there were any recommended ways of optimizing
the process.

For instance, can I turn off the redraw/refreshing on the document until I'm
finished (or hide it entirely).
If you use Range.Find instead of Selection.Find then there should be a lot
less "movement" on the screen. Other than that, there's
Application.ScreenUpdating = False.

For any further suggestions, we'd need to understand how you've built your
code; what's happening once you've found something. And how you continue the
"Find" process.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
E

Evan Stone

If you use Range.Find instead of Selection.Find then there should be a lot
less "movement" on the screen.

Actually I'm currently using Range.Find, so that base is covered.
Other than that, there's
Application.ScreenUpdating = False.

I think that's the one I was looking for. I'll give it a shot and see how it
performs...

many thanks!

evan stone | software engineer
 
C

Cindy M -WordMVP-

Hi Evan,
Actually I'm currently using Range.Find, so that base is covered.


I think that's the one I was looking for. I'll give it a shot and see how it
performs...
OK. If things still seems slow, describe how you're using Find and show us the
basic code (how you're setting/using the Range(s). Ranges can get extremely
slow with Find if Word has to spend a lot of time calculating the position...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
E

Evan Stone

Here's a good optimization tip... make sure the Forward parameter of the
Execute method is set to TRUE!

I think it sped up my search fivefold. Plus, with the ConvertToTable()
method for generating tables from tab delimited strings, this is *really*
flying... :D

Thanks for all your help!

evan k. stone | software engineer
 
C

Cindy M -WordMVP-

Hi Evan,
Here's a good optimization tip... make sure the Forward parameter of the
Execute method is set to TRUE!
thank you very much for this :)

So glad things are beginning to "hum"!

Cindy Meister
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top