Find/Replace macro problem in selected table column

H

hinesgg

I've created a macro that selects a column and performs several search and
replace functions in that column. When I play the macro back Word asks the
user if (s)he wants to search the entire document after each search. With
over 40 search/replace functions that gets a bit annoying. Is there some
code I can include in the macro after each search to eliminate this?
 
H

Helmut Weber

Hi,

try
.wrap = wdfindstop

But with columns there may be complications.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
H

hinesgg

That didn't work. The pop-up window I keep getting says: Word has finished
searching the selection. Do you want to search the remainder of the document?

Any other ideas would be appreciated.
 
K

Klaus Linke

That didn't work.

What didn't work? Did you look in your macro for all lines like
.Wrap = wdFindAsk
and replaced them with
.Wrap = wdFindStop
?

Klaus
 
H

hinesgg

Here's my code:

Selection.SelectColumn
With Selection.Find
.Text = "3_440 HR **"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Wrap = wdFindStop

I'm not a programmer, so I created this macro by recording keystrokes. I
then copied and pasted the code and edited the contents in the quotation
marks. After each search and replace I am asked if I want to search from the
beginning. That pop-up box is what I'd like to eliminate.

Thanks for all your help.
 
K

Klaus Linke

Selection.SelectColumn
With Selection.Find
.Text = "3_440 HR **"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll


:) Klaus
 
H

hinesgg

Woo Hoo! It worked.

Duuuhhhh! Guess I was looking in the wrong place.

Thanks to all!
 
H

Helmut Weber

Hi Klaus,

I see, giving the same advice twice or three times,
thanks to Greg, increases the effect by more then three times.
Reminds me of "Gestalt"-theory:
"The whole is more than the sum of it's parts."
Some, however, maintain that the opposite is true.
They are wrong, I'd say.

lol

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://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