using replace

  • Thread starter Thread starter John Garate
  • Start date Start date
J

John Garate

Word 2002, Win XP SP-2
I would like to be able to use find/replace to locate and change words that
are white font, and with a blue background (set in the Borders command). I
would like to change them to black font, no background. However, the
find/replace command doesn't seem to have a setting for Borders. Is there a
way around this?
 
John said:
Word 2002, Win XP SP-2
I would like to be able to use find/replace to locate and change
words that are white font, and with a blue background (set in the
Borders command). I would like to change them to black font, no
background. However, the find/replace command doesn't seem to have a
setting for Borders. Is there a way around this?

Hi John,

That's a regrettable oversight. It is possible to do it with a macro,
though. See http://www.gmayor.com/installing_macro.htm for installation
instructions.

Public Sub ReformatWhiteOnBlue()
Dim oRg As Range
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Format = True
.Font.Color = wdColorWhite
.Text = ""
.Forward = True
.Wrap = wdFindStop
Do While .Execute
If oRg.ParagraphFormat.Shading _
.BackgroundPatternColorIndex = wdBlue Then
oRg.Font.Color = wdColorAutomatic
oRg.ParagraphFormat.Shading _
.BackgroundPatternColorIndex = wdAuto
End If
Loop
End With
End Sub
 
The font colour can be changed using Edit Replace.
In your specific case where you want to remove the background colour (not
change the colour) it can be done via Excel. Change your text to a table and
copy the contents of the table to Excel. The background colour is not copied.
Copy back to Word and change table to text.
Something like this:
Replace paragraph mark with £.
Replace space with ¥(space).
Convert text to table, space as separator. Do not choose too many columns,
say 7.
Copy contents of table to Excel. Background colour will now be lost.
Copy Excel contents back to Word.
Convert table to text, choosing space as separator.
Remove paragraph mark and space.
Replace £ with paragraph mark.
Replace ¥ with space.
 

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

Back
Top