Thread: [Solved] Help on Genderhighlight code
View Single Post
 
Old 08-05-2015, 06:54 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,374
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub HiLightGender()
Application.ScreenUpdating = False
Dim StrFnd As String, i As Long
With ActiveDocument.Range.Find
  .ClearFormatting
  With .Replacement
    .ClearFormatting
    .Text = "^&"
    .Highlight = True
  End With
  .Forward = True
  .Wrap = wdFindContinue
  .Format = True
  .MatchCase = False
  .MatchWholeWord = True
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = True
  Options.DefaultHighlightColorIndex = wdTurquoise
  StrFnd = "boy,man,male,gentleman,his,he,guy"
  For i = 0 To UBound(Split(StrFnd, ","))
    .Text = Split(StrFnd, ",")(i)
    .Execute Replace:=wdReplaceAll
  Next
  Options.DefaultHighlightColorIndex = wdPink
  StrFnd = "girl,woman,female,lady,her,she,gal"
  For i = 0 To UBound(Split(StrFnd, ","))
    .Text = Split(StrFnd, ",")(i)
    .Execute Replace:=wdReplaceAll
  Next
End With
Application.ScreenUpdating = True
End Sub
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote