VBA word macro to highlight a selected text just like a spell checker
I used the below code to count the no. of words in sentences. If no. of words is greater than 20 then it should highlight it. I used the below code. It's just coloring the background. I want to just highlight it just like spell checker. please help.
Code:
Sub Count_of_words()
'
' Count Macro
'
'
Dim s As Range
For Each s In Selection.Sentences
If s.Words.count > 20 Then s.HighlightColorIndex = wdYellow
Next
End Sub
|