ListFormat Object

Represents the list formatting attributes that can be applied to the paragraphs in a range.



ListFormat Property

Returns a ListFormat object that represents all the list formatting characteristics of a range. Read-only.
Use the List or ListTemplate property to return the list or list template from the first paragraph in the specified range.


Use the ListFormat property to return the ListFormat object for a range.
The following example applies the default bulleted list format to the selection.

Selection.Range.ListFormat.ApplyBulletDefault 

Use the ListFormat property with a Range object to access the list formatting properties and methods available for the specified range.


This example sets the variable myDoc to a range that includes paragraphs three through six of the active document.
The example then either applies the default outline-numbered list format to the range or removes it, depending on whether or not the format was already applied to the range.

Set myDoc = ActiveDocument 
Set myRange = _
    myDoc.Range(Start:= myDoc.Paragraphs(3).Range.Start, _
    End:=myDoc.Paragraphs(6).Range.End)
myRange.ListFormat.ApplyOutlineNumberDefault


This example applies the second list template on the Numbered tab in the Bullets and Numbering dialog box to all the paragraphs in the selection.

Selection.Range.ListFormat.ApplyListTemplate _ 
    ListTemplate:=ListGalleries(wdListGalleryType.wdNumberGallery).ListTemplates(2)


The following example applies the default bullet list format to the second paragraph in the active document.

ActiveDocument.Paragraphs(2).Range.ListFormat.ApplyBulletDefault 


However, if there's already a list defined in your document, you can access a List object by using the Lists property.
The following example changes the format of the list created in the preceding example to the first number format on the Numbered tab in the Bullets and Numbering dialog box.

ActiveDocument.Lists(1).ApplyListTemplate ListTemplate:=ListGalleries(2).ListTemplates(1) 


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext