ListTemplate Object

Microsoft Word Visual Basic

Multiple objectsListTemplate
ListLevels

Represents a single list template that includes all the formatting that defines a list. The ListTemplate object is a member of the ListTemplates collection. Each of the seven formats (excluding None) found on each of the three tabs in the Bullets and Numbering dialog box corresponds to a list template object. These predefined list templates can be accessed from the three ListGallery objects in the ListGalleries collection. Documents and templates can also contain collections of list templates.

Using the ListTemplate Object

Use ListTemplates(index), where index is a number from 1 through 7, to return a single list template from a list gallery. The following example returns the third list format (excluding None) on the Numbered tab in the Bullets and Numbering dialog box.

Set temp3 = ListGalleries(2).ListTemplates(3)
		

Note  Some properties and methods— Convert and Add, for example— won't work with list templates that are accessed from a list gallery. You can modify these list templates, but you cannot change their list gallery type (wdBulletGallery, wdNumberGallery, or wdOutlineNumberGallery).

The following example sets an object variable equal to the list template used in the third list in the active document, and then it applies that list template to the selection.

Set myLt = ActiveDocument.ListTemplates(3)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLt
		

Use the Add method to add a list template to the collection of list templates in a document or template.

Resetting a List Template in the Gallery

To see whether the specified list template contains the formatting built into Word, use the Modified property with the ListGallery object. To reset formatting to the original list format, use the Reset method for the ListGallery object.

Remarks

After you have returned a ListTemplate object, use ListLevels(index), where index is a number from 1 through 9, to return a single ListLevel object. With a ListLevel object, you have access to all the formatting properties for the specified list level, such as Alignment, Font, NumberFormat, NumberPosition, NumberStyle, and TrailingCharacter.

Use the Convert method to convert a multiple-level list template to a single-level template.