|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
楼主如果不喜欢各种颜色,可以注释或删除颜色语句,也可以全选/自动色全文。
Sub test()
On Error Resume Next
Dim i As Paragraph
For Each i In ActiveDocument.Paragraphs
If i.Range Like "第[一二三四五六七八九十]章*" Or i.Range Like "第[二三四五六七八九十][一二三四五六七八九十]章*" Or i.Range Like "第[二三四五六七八九]十[一二三四五六七八九]章*" Then
i.Range.Font.Color = wdColorRed '红色
i.Range.Characters(InStr(i.Range, "章")).InsertAfter Text:="A"
ElseIf i.Range Like "第#章*" Or i.Range Like "第##章*" Or i.Range Like "第###章*" Then
i.Range.Font.Color = wdColorPink '粉红
i.Range.Characters(InStr(i.Range, "章")).InsertAfter Text:="B"
ElseIf i.Range Like "第[一二三四五六七八九十]条*" Or i.Range Like "第[二三四五六七八九十][一二三四五六七八九十]条*" Or i.Range Like "第[二三四五六七八九]十[一二三四五六七八九]条*" Then
i.Range.Font.Color = wdColorBlue '蓝色
i.Range.Characters(InStr(i.Range, "条")).InsertAfter Text:="C"
ElseIf i.Range Like "第#条*" Or i.Range Like "第##条*" Or i.Range Like "第###条*" Then
i.Range.Font.Color = wdColorGreen '绿色
i.Range.Characters(InStr(i.Range, "条")).InsertAfter Text:="D"
End If
Next
End Sub |
评分
-
1
查看全部评分
-
|