Find delete words

K

Khalid

Hi everyone,

I wanted to know if there is a way to search through a
document and delete every instance of word. I've tried a
bunch of things so far. I can find every instance of a
word, but I can't find how to delete them. The closest I
got was to replace them with blanks.

Thanks for the help!
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Khalid > écrivait :
In this message, < Khalid > wrote:

|| Hi everyone,
||
|| I wanted to know if there is a way to search through a
|| document and delete every instance of word. I've tried a
|| bunch of things so far. I can find every instance of a
|| word, but I can't find how to delete them. The closest I
|| got was to replace them with blanks.
||

Sometimes the light shines so bright, it blinds us!
I have been there! ;-)

Replace with nothing instead of blanks!
(I mean, make sure that the "Replace by" box is absolutely empty.)

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Guest

Yeah I tried that before. The problem is that it leaves
the spacing before and after. I know I could just include
a space in the findtext statement, but I thought there was
a more efficient way
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < (e-mail address removed) > écrivait :

| Yeah I tried that before. The problem is that it leaves
| the spacing before and after. I know I could just include
| a space in the findtext statement, but I thought there was
| a more efficient way
|

You could run a second Find/Replace to change all double spaces to single
spaces.
You cannot really include the space in the search string. What if the word
is followed by a comma, or preceded by a ( or a "?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < (e-mail address removed) > écrivait :

| Actually, in vB you can specify any text you like in the
| FIND statement.
|
|

I did not write that you COULD not, rather, I wrote:
<quote>
You cannot really include the space in the search string. What if the word
is followed by a comma, or preceded by a ( or a "?
<end quote>

If you want to delete "apple" and want to delete the following space, you
can specify "apple " in the search string, but all the "apple,", "apple"" or
"apple) will not be deleted.
That is all I meant.

Your best bet is to do it three times, keeping "apple" last:
1. " apple"
2. "apple "
3. "apple"

Then you are certain that no double spaces are left behind and that you do
not end up with a word followed by a space followed by a comma as in: "red
apple," that would become "red ,".
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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