Sub 自定义多级列表_关联内置标题样式()
' 说明:1.由于本帖附件已经具有了内置标题样式,所以代码如下
' 2.如果没有内置标题样式,可以先自定义多级列表_关联内置标题样式后再查找标题“并应用此自定义样式”
Dim doc As Document
Set doc = ActiveDocument
sr$ = "〇一二三四五六七八九十百千万亿"
r1$ = "^13[" & sr & "]@、": r2$ = "^13[((][" & sr & "]@[))]"
r3$ = "^13[0-9]@[、..]": r4$ = "^13[((][0-9]@[))]"
With doc.Content.Find
.Execute "^11", , , 1, , , , , , "^p", 2
.Execute "^p^w", , , 0, , , , , , "^p", 2
.Execute r1, , , 1, , , , , , "^p", 2
.Execute r2, , , 1, , , , , , "^p", 2
.Execute r3, , , 1, , , , , , "^p", 2
.Execute r4, , , 1, , , , , , "^p", 2
End With
With ListGalleries(3).ListTemplates(1)
.ListLevels(2).NumberFormat = "%2、": .ListLevels(2).NumberStyle = 37
.ListLevels(3).NumberFormat = "(%3)": .ListLevels(3).NumberStyle = 37
.ListLevels(4).NumberFormat = "%4.": .ListLevels(4).NumberStyle = 0
.ListLevels(5).NumberFormat = "(%5)": .ListLevels(5).NumberStyle = 0
End With
For i = 2 To 5
With ListGalleries(3).ListTemplates(1).ListLevels(i)
.TrailingCharacter = 2: .StartAt = 1: .ResetOnHigher = True
.LinkedStyle = "标题 " & i
End With
Next
doc.Content.InsertAfter Chr(13)
With doc.Range(doc.Content.End - 1, doc.Content.End - 1)
.ListFormat.ApplyListTemplate ListGalleries(3).ListTemplates(1): .Delete
End With
End Sub |