ListTemplates Collection Object

Microsoft Word Visual Basic

Multiple objectsListTemplates
ListTemplate
ListLevels

A collection of ListTemplate objects that represent the seven predefined list formats on each tab in the Bullets and Numbering dialog box.

Using the ListTemplates Collection

Use the ListTemplates property to return the ListTemplates collection. The following example displays a message with the level status (single or multiple-level) for each list template in the active document.

For Each lt In ActiveDocument.ListTemplates
    MsgBox "This is a multiple-level list template - " _
    & lt.OutlineNumbered
Next LT
		

Use the Add method to add a list template to the collection in the specified document or template. The following example adds a new list template to the active document and applies it to the selection.

Set myLT = ActiveDocument.ListTemplates.Add
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLT
		

Use ListTemplates(index), where index is a number 1 through 7, to return a single list template from a list gallery. 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
		

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).

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.