Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Hey Scripting GUy, Please look below the script for searching for a particular alphabet in the entire word doc !

$
0
0

Sub HighlightTargets2()

Dim range As range

Dim i As Long

Dim TargetList

TargetList = Array("m", "bo", "a") ' put list of terms to find here

For i = 0 To UBound(TargetList)

Set range = ActiveDocument.range

With range.Find

.Text = TargetList(i)

.Format = True

.MatchCase = True

.MatchWholeWord = False

.MatchWildcards = False

.MatchSoundsLike = False

.MatchAllWordForms = False

Do While .Execute(Forward:=True) = True

range.HighlightColorIndex = wdYellow

Loop

End With

Next

End Sub

The above scrips highlights the occurence of m,bo and a in the entire word doc. But i want to highlight the entire word that contains the alphabet. Please help me on this


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>