|
楼主 |
发表于 2017-10-25 17:46
|
显示全部楼层
已解决
- Sub teaame()
- Dim d As Document, reg As Object, rngParagraph, p As Paragraph, rngDoc As Range
- Set d = ActiveDocument: d.Content.HighlightColorIndex = 0
- Set reg = CreateObject("VBScript.Regexp")
- reg.Global = True: reg.Pattern = "[A-Z][a-z]*, ([A-Z].)+;"
- For Each p In d.Paragraphs
- If reg.Execute(p.Range.Text).count > 1 And reg.Execute(p.Range.Text).count < 10 And InStr(p, "et al") > 0 Then
-
-
- m = InStr(p, "et al") - 1
-
- With d.Range(p.Range.Start + m, p.Range.Start + m + 5)
- .HighlightColorIndex = 6
- End With
-
- End If
-
- Next
-
- End Sub
复制代码 |
|