Lists Object
TOC
Collapse the table of content
Expand the table of content

Lists Object (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

A collection of List objects that represent all the lists in the specified document.

Use the Lists property to return the Lists collection. The following example displays the number of items in each list in the active document.

For Each li In ActiveDocument.Lists 
 MsgBox li.CountNumberedItems 
Next li

Use Lists(Index), where Index is the index number, to return a single List object. The following example applies the first list format (excluding None) on the Numbered tab in the Bullets and Numbering dialog box to the second list in the active document.

Set temp1 = ListGalleries(wdNumberGallery).ListTemplates(1) 
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=temp1

When you use a For Each loop to enumerate the Lists collection, the lists in a document are returned in reverse order. The following example counts the items for each list in the active document, from the bottom of the document upward.

For Each li In ActiveDocument.Lists 
 MsgBox li.CountNumberedItems 
Next li

To add a new list to a document, use the ApplyListTemplate method with the ListFormat object for a specified range.

You can manipulate the individual List objects within a document, but for more precise control you should work with the ListFormat object.

Note Note

Picture-bulleted lists are not included in the Lists collection.

Show:
© 2016 Microsoft