ListFormat.ApplyListTemplateWithLevel method (Word)

Applies a set of list-formatting characteristics, optionally for a specified level.

Syntax

expression. ApplyListTemplateWithLevel( _ListTemplate_ , _ContinuePreviousList_ , _ApplyTo_ , _DefaultListBehavior_ , _ApplyLevel_ )

expression A variable that represents a 'ListFormat' object.

Parameters

Name Required/Optional Data type Description
ListTemplate Required ListTemplate The list template to be applied.
ContinuePreviousList Optional Variant True to continue the numbering from the previous list; False to start a new list.
ApplyTo Optional Variant One of the WdListApplyTo constants that specifies the portion of the list that the list template will be applied to.
DefaultListBehavior Optional Variant Sets a value that specifies whether Microsoft Word uses new Web-oriented formatting for better list display. Can be either of the following WdDefaultListBehavior constants: wdWord8ListBehavior (use formatting compatible with Microsoft Word 97) or wdWord9ListBehavior (use Web-oriented formatting). For compatibility reasons, the default constant is wdWord8ListBehavior, but in new procedures you should use wdWord9ListBehavior to take advantage of improved Web-oriented formatting for indenting and multiple-level lists.
ApplyLevel Optional Variant The level to which the list template is to be applied.

Example

The following example sets the variable myRange to a range in the active document, and then it verifies 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

See also

ListFormat Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.