Example:
I have a: (this is the lead in sentence, notice the end of the lead in
sentence has a COLON. And also every lead in sentence is followed by a list)
*Book
*Pen
*paper
--
I believe in Hope.
DesigningSally
Also, the routine puts the "AVOID" comment on the whole lead-in sentence,
not just the words that you want to avoid.
Dim lList As Long
Dim oRng As Range
For lList = ActiveDocument.Lists.Count To 1 Step -1
Set oRng = ActiveDocument.Lists(lList).ListParagraphs(1).Range
With oRng
.Collapse Direction:=wdCollapseStart
.MoveStart Unit:=wdSentence, Count:=-1
.MoveEnd Unit:=wdCharacter, Count:=-1
If .Characters.Last <> ":" Then
.InsertAfter Text:=":"
End If
If InStr(1, .Text, "various") Or InStr(1, .Text, "as follows") Then
ActiveDocument.Comments.Add Range:=oRng, Text:="AVOID"
End If
End With
Next lList
HTH,
Dave
I want various and as follows to be highlighted in the comment box. Is that
possible?
Let me know.
--
I believe in Hope.
DesigningSally
Dave
Sub jf()
Dim lList As Long
Dim oRng As Range
For lList = ActiveDocument.Lists.Count To 1 Step -1
Set oRng = ActiveDocument.Lists(lList).ListParagraphs(1).Range
With oRng
.Collapse Direction:=wdCollapseStart
.MoveStart Unit:=wdSentence, Count:=-1
.MoveEnd Unit:=wdCharacter, Count:=-1
If .Characters.Last <> ":" Then
.InsertAfter Text:=":"
End If
If InStr(1, .Text, "various") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID"
If InStr(1, .Text, "as follows") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID"
End If
End If
End With
Next lList
End Sub