Word VBA教程:ApplyPictureBullet方法



expression   必需。该表达式返回“应用于”列表中的一个对象。

FileName  String 类型,必需。图片文件的路径和文件名。



Sub ApplyPictureBulletsToParagraphs()
    Dim docNew As Document
    Dim rngRange As Range
    Dim lstTemplate As ListTemplate
    Dim intPara As Integer
    Dim intCount As Integer
    'Set the initial value of object variables
    Set docNew = Documents.Add
    'Add paragraphs to the new document, including eight list items
    With Selection
        .TypeText Text:="This is an introductory paragraph."
    End With
    Do Until intPara = 8
        With Selection
            .TypeText Text:="This is a list item."
        End With
        intPara = intPara + 1
    Selection.TypeText Text:="This is a concluding paragraph."
    'Count the total number of paragraphs in the document
    intCount = docNew.Paragraphs.Count
    'Set the range to include all paragraphs in the
    'document except the first and the last
    Set rngRange = docNew.Range( _
        Start:=ActiveDocument.Paragraphs(2).Range.Start, _
        End:=ActiveDocument.Paragraphs(intCount - 1).Range.End)
    'Format the list template as a bullet
    Set lstTemplate = ListGalleries(Index:=wdBulletGallery) _
    'Format list with a picture bullet
    lstTemplate.ListLevels(1).ApplyPictureBullet _
    'Apply the list format settings to the range
    rngRange.ListFormat.ApplyListTemplate _
End Sub

Word VBA教程

Word VBA参考教程:目录1 Word VBA参考教程:目录2
Word VBA参考教程:目录3 Word VBA参考教程:目录4
Word VBA参考教程:目录5 Word VBA参考教程:目录6
Word VBA参考教程:目录7 Word VBA参考教程:目录8
Word VBA参考教程:目录9 Word VBA参考教程:目录10
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号