|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
最近比较忙!刚上论坛就收到提示,看了你这奇怪的需求,我根据你的附件写了一个,
你测试一下吧!
- Sub shishi()
- Dim Arng As Range, Orng As Range, mt, m%, n%
- Set Arng = ActiveDocument.Content
- With CreateObject("VBScript.Regexp")
- .Global = True: .MultiLine = True
- .Pattern = "^[ ( ]*[一二三四五六七八九十]+)((?!([一二三四五六七八九十]+)).)*\r"
- For Each mt In .Execute(Arng.Text)
- m = mt.FirstIndex: n = mt.Length
- Set Orng = ActiveDocument.Range(m, m + n)
- Orng.Font.ColorIndex = 6
- Next
- .Pattern = "[。\r]((?!^[ ( ]+[一二三四五六七八九十]+).*?[。\r]).)+"
- For Each mt In .Execute(Arng.Text)
- m = mt.FirstIndex: n = mt.Length
- Set Orng = ActiveDocument.Range(m, m + n)
- Orng.Font.ColorIndex = wdAuto
- Next
- End With
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|