ApplyListTemplate Method Example

This example sets the variable myRange to a range in the active document, and then it checks to see whether the range has list formatting. If no list formatting has been applied, the fourth outline-numbered list template is applied to the range.

Set myDoc = ActiveDocument
Set myRange = myDoc.Range( _
    Start:= myDoc.Paragraphs(3).Range.Start, _
    End:=myDoc.Paragraphs(6).Range.End)
If myRange.ListFormat.ListType = wdListNoNumbering Then
    myRange.ListFormat.ApplyListTemplate _
        ListTemplate:=ListGalleries(wdOutlineNumberGallery) _
        .ListTemplates(4)
End If

This example sets the variable myList to the fourth list in MyDocument.doc, and then it applies the third bulleted list template to the list.

Set myList = Documents("MyDocument.doc").Lists(4)
myList.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdBulletGallery).ListTemplates(3)

This example sets the variable myLstRange to the list formatting in the second paragraph of MyDocument.doc. The example then applies the third numbered list template from that point forward in the list.

Set myLstRange = Documents("MyDocument.doc").Paragraphs(2) _
    .Range.ListFormat
myLstRange.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery) _
    .ListTemplates(3), _
    ApplyTo:=wdListApplyToThisPointForward