How advanced is the "replace" function in Word 2000?



Ted Shoemaker
07-09-2005, 11:05 PM
Hello,

I have a long *.doc file in Word 2000. I would like to locate all the
places in that document which use red text, and insert the word "Robin"
there. Is there an easy way to do this? I don't want to slog through
the document myself, line by line. In case it helps, I'm interested
here only in the standard red color, not in the millions of custom colors.

And let's generalize that question. The "replace" function is set up to
replace text, ignoring font, placement, etc. Suppose I want to change
all occurrences of something without considering the verbal content of
the text itself (e.g. I'm looking for all uses of a certain font, color,
location on the page, etc). Is there a way of manipulating this?

Probably I'm looking for something other than the "replace" function.

Thank you for all help.

Ted Shoemaker

Anne Troy
07-09-2005, 11:05 PM
This (recorded) macro finds the first red-text character in the doc, backs
up a space, inserts "SomeWordHere".

If you wanted to do this continuously, you'll have to get the code
re-worked.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded July 8, 2005 by Anne Troy
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^?"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="SomeWordHere "
End Sub
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


"Ted Shoemaker" <shoemakerted@yahoo.com> wrote in message
news:42cec8fe_2@newspeer2.tds.net...
>
> Hello,
>
> I have a long *.doc file in Word 2000. I would like to locate all the
> places in that document which use red text, and insert the word "Robin"
> there. Is there an easy way to do this? I don't want to slog through
> the document myself, line by line. In case it helps, I'm interested
> here only in the standard red color, not in the millions of custom colors.
>
> And let's generalize that question. The "replace" function is set up to
> replace text, ignoring font, placement, etc. Suppose I want to change
> all occurrences of something without considering the verbal content of
> the text itself (e.g. I'm looking for all uses of a certain font, color,
> location on the page, etc). Is there a way of manipulating this?
>
> Probably I'm looking for something other than the "replace" function.
>
> Thank you for all help.
>
> Ted Shoemaker
>

SVC
07-09-2005, 11:05 PM
Try this link:

http://word.mvps.org/FAQs/General/FindingSpecialCharacters.htm

"Ted Shoemaker" wrote:

>
> Hello,
>
> I have a long *.doc file in Word 2000. I would like to locate all the
> places in that document which use red text, and insert the word "Robin"
> there. Is there an easy way to do this? I don't want to slog through
> the document myself, line by line. In case it helps, I'm interested
> here only in the standard red color, not in the millions of custom colors.
>
> And let's generalize that question. The "replace" function is set up to
> replace text, ignoring font, placement, etc. Suppose I want to change
> all occurrences of something without considering the verbal content of
> the text itself (e.g. I'm looking for all uses of a certain font, color,
> location on the page, etc). Is there a way of manipulating this?
>
> Probably I'm looking for something other than the "replace" function.
>
> Thank you for all help.
>
> Ted Shoemaker
>
>

Jay Freedman
07-09-2005, 11:05 PM
Hi Anne,

There's a bug in the recorder that makes it fail to record the kind of
formatting you're searching for. After the .Text line you need to insert

.Font.Color = wdColorRed

to make it look for red text. This is one of several bugs I wrote about in
http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm.

The macro would also need a loop inserted around the .Execute and .TypeText
lines to make it find all the occurrences. There would have to be a tricky
little bit at the end of that loop that moves the Selection to a point after
the red text, so it doesn't keep finding the same red text over and over.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Anne Troy wrote:
> This (recorded) macro finds the first red-text character in the doc,
> backs up a space, inserts "SomeWordHere".
>
> If you wanted to do this continuously, you'll have to get the code
> re-worked.
>
> Sub Macro1()
> '
> ' Macro1 Macro
> ' Macro recorded July 8, 2005 by Anne Troy
> '
> Selection.Find.ClearFormatting
> With Selection.Find
> .Text = "^?"
> .Replacement.Text = ""
> .Forward = True
> .Wrap = wdFindContinue
> .Format = True
> .MatchCase = False
> End With
> Selection.Find.Execute
> Selection.MoveLeft Unit:=wdCharacter, Count:=1
> Selection.TypeText Text:="SomeWordHere "
> End Sub
> *******************
> ~Anne Troy
>
> www.OfficeArticles.com
> www.MyExpertsOnline.com
>
>
> "Ted Shoemaker" <shoemakerted@yahoo.com> wrote in message
> news:42cec8fe_2@newspeer2.tds.net...
>>
>> Hello,
>>
>> I have a long *.doc file in Word 2000. I would like to locate all
>> the places in that document which use red text, and insert the word
>> "Robin" there. Is there an easy way to do this? I don't want to
>> slog through the document myself, line by line. In case it helps,
>> I'm interested here only in the standard red color, not in the
>> millions of custom colors.
>>
>> And let's generalize that question. The "replace" function is set
>> up to replace text, ignoring font, placement, etc. Suppose I want
>> to change all occurrences of something without considering the
>> verbal content of the text itself (e.g. I'm looking for all uses of
>> a certain font, color, location on the page, etc). Is there a way
>> of manipulating this?
>>
>> Probably I'm looking for something other than the "replace" function.
>>
>> Thank you for all help.
>>
>> Ted Shoemaker

Anne Troy
07-09-2005, 11:05 PM
LOL! Stupid me. I didn't even notice. Thanks, doll! :)
*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


"Jay Freedman" <jay.freedman@verizon.net> wrote in message
news:%23GQZlY$gFHA.2180@TK2MSFTNGP15.phx.gbl...
> Hi Anne,
>
> There's a bug in the recorder that makes it fail to record the kind of
> formatting you're searching for. After the .Text line you need to insert
>
> .Font.Color = wdColorRed
>
> to make it look for red text. This is one of several bugs I wrote about in
> http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm.
>
> The macro would also need a loop inserted around the .Execute and
..TypeText
> lines to make it find all the occurrences. There would have to be a tricky
> little bit at the end of that loop that moves the Selection to a point
after
> the red text, so it doesn't keep finding the same red text over and over.
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org
>
> Anne Troy wrote:
> > This (recorded) macro finds the first red-text character in the doc,
> > backs up a space, inserts "SomeWordHere".
> >
> > If you wanted to do this continuously, you'll have to get the code
> > re-worked.
> >
> > Sub Macro1()
> > '
> > ' Macro1 Macro
> > ' Macro recorded July 8, 2005 by Anne Troy
> > '
> > Selection.Find.ClearFormatting
> > With Selection.Find
> > .Text = "^?"
> > .Replacement.Text = ""
> > .Forward = True
> > .Wrap = wdFindContinue
> > .Format = True
> > .MatchCase = False
> > End With
> > Selection.Find.Execute
> > Selection.MoveLeft Unit:=wdCharacter, Count:=1
> > Selection.TypeText Text:="SomeWordHere "
> > End Sub
> > *******************
> > ~Anne Troy
> >
> > www.OfficeArticles.com
> > www.MyExpertsOnline.com
> >
> >
> > "Ted Shoemaker" <shoemakerted@yahoo.com> wrote in message
> > news:42cec8fe_2@newspeer2.tds.net...
> >>
> >> Hello,
> >>
> >> I have a long *.doc file in Word 2000. I would like to locate all
> >> the places in that document which use red text, and insert the word
> >> "Robin" there. Is there an easy way to do this? I don't want to
> >> slog through the document myself, line by line. In case it helps,
> >> I'm interested here only in the standard red color, not in the
> >> millions of custom colors.
> >>
> >> And let's generalize that question. The "replace" function is set
> >> up to replace text, ignoring font, placement, etc. Suppose I want
> >> to change all occurrences of something without considering the
> >> verbal content of the text itself (e.g. I'm looking for all uses of
> >> a certain font, color, location on the page, etc). Is there a way
> >> of manipulating this?
> >>
> >> Probably I'm looking for something other than the "replace" function.
> >>
> >> Thank you for all help.
> >>
> >> Ted Shoemaker
>
>

Klaus Linke
07-09-2005, 11:05 PM
Hi Ted,

Probably you have discovered by now that you can find red text by going into
"Format > Font" in the "Edit > Replace" dialog?
You can just leave the "Find what" text empty if you want to search some
formatting.

If you want to replace the red text with the text "Robin", you put "Robin"
in "Replace with". You can apply some other color (say, "automatic") at the
same time, again by choosing that in "Format > Font" while the cursor is in
"Replace with".

If you want to add "Robin" in front of any red text, you'd put "Robin^&" in
"Replace with".
^& will insert the found text. You don't have to remember the placeholder
^&: It's listed among other text when you click on the "Special" button.

Searching for some font would work the same. Searching for a certain
location on the page isn't so simple, but you can search for special
formatting or special characters that determine the location (say "page
break before" in the paragraph format, or manual page breaks, column breaks,
line breaks, ...), or you can limit your search to specific regions (say
footnotes or comments).

Regards,
Klaus


"Ted Shoemaker" <shoemakerted@yahoo.com> wrote:
>
> Hello,
>
> I have a long *.doc file in Word 2000. I would like to locate all the
> places in that document which use red text, and insert the word "Robin"
> there. Is there an easy way to do this? I don't want to slog through the
> document myself, line by line. In case it helps, I'm interested here only
> in the standard red color, not in the millions of custom colors.
>
> And let's generalize that question. The "replace" function is set up to
> replace text, ignoring font, placement, etc. Suppose I want to change all
> occurrences of something without considering the verbal content of the
> text itself (e.g. I'm looking for all uses of a certain font, color,
> location on the page, etc). Is there a way of manipulating this?
>
> Probably I'm looking for something other than the "replace" function.
>
> Thank you for all help.
>
> Ted Shoemaker
>

shoemakerted@yahoo.com
07-09-2005, 11:05 PM
Good stuff here. Thanks for all replies.

Ted Shoemaker


How advanced is the "replace" function in Word 2000?