The List Object

The List object represents a single list format that has been applied to at least one paragraph in a document. The code:

	MsgBox ActiveDocument.Lists.Count

displays the number of List objects in the active document. Here are some of the properties of the List object:

The ListParagraphs property

Returns a ListParagraphs collection, which is the collection of all paragraph objects in the list that have list formatting. Note that this property also applies to the Document and Range objects, in which case some paragraphs may not have a list formatting.

The Range property

Returns a Range object that represents all paragraphs that lie between the first and last paragraphs in the list. This includes paragraphs that are not list-formatted. (See the earlier discussion of list objects.)

The SingleListTemplate property

A single list may use more than one list template; that is, it may have formatting from more than one list template. The SingleListTemplate property is True when a list uses only one list template. This is a read-only property. (I discuss list templates a bit later in this chapter.)

The ApplyListTemplate method

Applies a list template (that is, a list format) to the given List object. The syntax is:

ListObject.ApplyListTemplate(ListTemplate,_
ContinuePreviousList)

where ListTemplate is the list template to be applied. The optional ContinuePreviousList parameter is True to continue the previous list or False to start a new list with new numbering. (I discuss list ...

Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.