Facing Error with List

S

Sriram

I got this code

Sub list()

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
ActiveDocument.comments.Add Range:=oRng, Text:="Add"
End If
If InStr(1, .Text, "namely") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID using namely"
If InStr(1, .Text, "following") Then
ActiveDocument.comments.Add Range:=oRng, Text:="AVOID using following"
End If
End If
End With
Next lList

End Sub

Test data
There are discussions namely
• Qaz
• Qaa
• Qaa
There are following discussion forums
• Qaz
• Qaa
• Qaa

I m facing the following problem when I test data as pasted above. I
want macros to highlight namely and following present in the lead in
sentence. And I also want the macros to check if the end of the lead
in sentence has colon or period. If : or , is not present I want the
message to be displaying highlight at the end of the sentence were :
or . should appear (which is at the end of the lead in sentence)

Next I need macros to highlight namely and following ALONE in the lead
in sentence. And in a case if have 10 lists then I want macros to
check for : or , at the end of the lead in sentence and check for
namely and following ALONE in all 10 lists.

Messages can appear as comments or as message box also

Please some one help me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top