Lists Property

Microsoft Word Visual Basic

Returns a Lists collection that contains all the formatted lists in the specified document. Read-only.

For information about returning a single member of a collection, see Returning an Object from a Collection.

Example

This example formats the selection as a numbered list. The example then displays a message box that reports the number of lists in the active document.

Selection.Range.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)
MsgBox "This document has " & ActiveDocument.Lists.Count _
    & " lists."
		

This example formats the third list in the active document with the default bulleted list format. If the list is already formatted with a bulleted list format, the example removes the formatting.

If ActiveDocument.Lists.Count >= 3 Then
    ActiveDocument.Lists(3).Range.ListFormat.ApplyBulletDefault
End If
		

This example displays a message box that reports the number of items in each list in MyLetter.doc.

Set myDoc = Documents("MyLetter.doc")
i = myDoc.Lists.Count
For each li in myDoc.Lists
    Msgbox "List " & i & " has " & li.CountNumberedItems _
        & " items."
    i = i - 1
Next li