Find & Replace Stops Working

B

BobLitwack

I've been using Word 2000 on a up to date Dell running Windows XP
Professional for quite a long time with no problems. All of a sudden
if I've used Find and Replace once or twice, it stops working
correctly. By that I mean it does not "find" what it is searching for
even though it is there to be found. I've carefully typed and re-typed
the search, cut and pasted and even had it search for the letter "e".
Nothing. If I exit and restart Word (not just that document - I have
to exit the entire application) it works again for one or two instances
and then stops again. While this isn't major it is a pain.

Any suggestions?

Bob Litwack
 
B

BobLitwack

That may just be it. I use some macros I wrote to search for and
delete some characters in a particular font. I should re-write those
and clear the special formatting before I end the macro.

I'll let you know if it works. Thanks.

Bob Ltiwack
 
B

BobLitwack

Well, it sounded like a great idea but it didn't work. The macro
actually searched for a 44 point font and replaced it with a hard
return "^p". I've re-written the macro and cleared the find to
absolutely nothing (especially no formatting) before it ends. I saved
the macro and exited the program saving the Normal template. I opened
Word and ran the macro and Find lost the ability to find once again.

Puzzling. I thought you had it.

Bob Litwack
 
B

BobLitwack

Yep. I've done that in the past and did it again this morning. The
Find & Replace fields are blank. There is no formatting chosen and the
"No Formatting" box is grayed out showing that there are no formatting
choices to de-select.
 
K

Klaus Linke

BobLitwack said:
Yep. I've done that in the past and did it again this morning.
The Find & Replace fields are blank. There is no formatting
chosen and the "No Formatting" box is grayed out showing
that there are no formatting choices to de-select.


Hi Bob,

If you use Range.Find instead of Selection.Find in your macro, the Find
dialog won't pick the settings up.
There are probably other ways to clear the dialog programmatically, but that
would be a clean solution.

Regards,
Klaus
 
B

BobLitwack

You probably just went beyond my expertise. I created the macro using
the record macro feature and walked my way through what I needed done.
Would replacing the word "selection" with the word "range" in the macro
do what you suggest?
 
S

Stefan Blom

If you are basically working with a selection, you can replace
Selection with Selection.Range in your code. For example:
Selection.Find.Text = "text here" would then be replaced with
Selection.Range.Find.Text = "text here".

On the other hand, if you are performing the find and replace on a
whole document (not including headers, footers, and other areas
outside of the main body of the document), ActiveDocument.Content.Find
(etc.) could be used instead, since the Content property on Document
objects references a Range object.

A third possibility is to keep your current code, and then use the
code at http://word.mvps.org/faqs/macrosvba/ClearFind.htm to clear the
settings after each use.

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 

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