Lists 属性

       

返回一个 Lists 集合,该集合含有指定文档中的所有项目符号和编号列表。只读。

有关返回集合中单个成员的内容,请参阅返回集合中的对象

示例

本示例设置所选内容的格式为编号列表,然后在一个消息框中显示活动文档中列表数。

Selection.Range.ListFormat.ApplyListTemplate _
    ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(2)
MsgBox "This document has " & ActiveDocument.Lists.Count _
    & " lists."

本示例设置活动文档中第三个列表的格式为默认的项目符号列表格式。如果该列表已设置为项目符号列表格式,该示例清除此格式。

If ActiveDocument.Lists.Count >= 3 Then
    ActiveDocument.Lists(3).Range.ListFormat.ApplyBulletDefault
End If

本示例在一个消息框中显示 MyLetter.doc 的每一列表的项目数。

Set myDoc = Documents("MyLetter.doc")
i = myDoc.Lists.Count
For each li in myDoc.Lists
    Msgbox "List " & i & " has " & li.CountNumberedItems _
        & " items."
    i = i - 1
Next li