Clearing Find parameters

L

Larry

Is there a single, one line command that puts all the Search parameters
back to their default state? After doing a search, I always run things
like this:

With Selection.Find
.Text = ""
.Replacement.Text = ""
.MatchWildcards = False
End With

But I'm wondering if this is necessary.

Thanks,
Larry
 
J

Jay Freedman

Is there a single, one line command that puts all the Search parameters
back to their default state? After doing a search, I always run things
like this:

With Selection.Find
.Text = ""
.Replacement.Text = ""
.MatchWildcards = False
End With

But I'm wondering if this is necessary.

Thanks,
Larry

No, there isn't any single "reset" command. Grab the subroutine
ClearFindAndReplaceParameters from
http://www.word.mvps.org/FAQs/MacrosVBA/ClearFind.htm, and call it
after using Selection.Find. See
http://www.word.mvps.org/FAQs/MacrosVBA/FlushFR.htm for an example of
its use.
 
L

Larry

Hi Jay,

Yeah, of course, I've had that macro and run it in other macros for
years. I just wondered if there was a simple one-liner instead. :)
There ought to be.

Larry
 
J

Jay Freedman

Hi Larry,

I'd say it's a matter of little consequence. Once you have the
subroutine stashed in a global template, then clearing the Find object
*is* a one-liner, just the name of the ClearFindAndReplaceParameters
subroutine. The number of lines inside the subroutine is immaterial,
just as the number of lines of (probably C++) code needed to create a
built-in function in Word itself is immaterial.

--
Regards,
Jay Freedman
Microsoft Word MVP

Hi Jay,

Yeah, of course, I've had that macro and run it in other macros for
years. I just wondered if there was a simple one-liner instead. :)
There ought to be.

Larry
 

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