lists

D

Designingsally

If i have 5 lists. Can macros determine any word present only in the 4th
list? In general, can macros higlight or mark last but one(penultimate) list?

pls gimme me some idea
 
D

DaveLett

Hi,
If you mean accessing the penultimate list, then you can use something like
the following:
Dim oRng As Range
Set oRng = ActiveDocument.Lists(ActiveDocument.Lists.Count - 1).Range
If oRng.Find.Execute(FindText:="word") Then
oRng.Select
End If

If, however, you mean cycling through all lists in the document and
selecting a word in the penultimate item in that list, then you can use the
following:
Dim oRng As Range
Dim lLists As Long

For lLists = ActiveDocument.Lists.Count To 1 Step -1
With ActiveDocument.Lists(lLists)
Set oRng = .ListParagraphs(.ListParagraphs.Count - 1).Range
If oRng.Find.Execute(FindText:="word") Then
oRng.Select
End If
End With
Next lLists
End Sub

Dave
 
D

Designingsally

thanks dave It works. But i want to know if the macros can check if AND
occurs at the end of the penultimate list


Eg

I have:
* book
*car
*dog,cat,rat and ( check this and at the end of the list if and occurs in
the end it cna ignore)
*mat


if it is possible pls help me out
 

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

Top