Document.Lists Property (Word)

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


expression. Lists

expression A variable that represents a 'Document' object.


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


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 _ 
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 
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

See also

Document Object