View Single Post
 
Old 07-17-2013, 12:22 PM
flatop flatop is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2013
Posts: 5
flatop is on a distinguished road
Unhappy Find and highlight multiple words in a document

Code:
Sub HiLightList()
Application.ScreenUpdating = False
Dim StrFnd As String, Rng As Range, i As Long
StrFnd = "dog,cat,pig,horse,man"
For i = 0 To UBound(Split(StrFnd, ","))
  Set Rng = ActiveDocument.Range
  With Rng.Find
    .ClearFormatting
    .Text = Split(StrFnd, ",")(i)
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Replacement.Text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = True
    .Execute Replace:=wdReplaceAll
  End With
Next
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
Hello,

is it possible to get this macro to work for Outlook 2010 or I should say the same concept?

Last edited by flatop; 07-17-2013 at 12:30 PM. Reason: Clarification
Reply With Quote