Document.Lists property (Word)
Returns a Lists collection that contains all the formatted lists in the specified document. Read-only.
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 _ 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.