Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word97 - Auto change format

Status
Not open for further replies.

SHardy

Programmer
May 9, 2001
231
GB
I have a word document that someone has been through and highlighting items by changing the font colour to red. Before issuing a copy of this document, I need to change the formatting of all these highlighted bits of text. In effect going through the whole document and wherever the background is white and text is red, I need to change it so that background is black and text is black.

This is a VERY big document, and to do this manually will be very time consuming.

Is there a quicker way of doing this?

I am guessing that a VBA macro could work through the text looking at formats and changing them where necessary.

Any help on how to do this would be greatly appreciated.

Thanks,
Simon
 
Job done:

Sub BlackOut()
Selection.Find.ClearFormatting
Selection.Find.Font.ColorIndex = wdRed
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.ColorIndex = wdBlack
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Options.DefaultHighlightColorIndex = wdBlack
Selection.Find.ClearFormatting
Selection.Find.Font.ColorIndex = wdRed
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Highlight = True
Selection.Find.Replacement.Font.ColorIndex = wdBlack
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top