|
本帖最后由 duquancai 于 2016-7-16 10:17 编辑
勾选使用通配符查找框中输入“^13第[!条]@条”(不包括引号) 替换框中“加粗”(替换中框中:ctrl+b)格式。或者在查找框输入“^13第[!条]@条”(不包括引号)再点击开始菜单“加粗”。WordVBA请测试:
Sub Word运用格式()
Dim i As Paragraph, mt, oRang As Range, n%, m%
With CreateObject("vbscript.regexp")
.Pattern = "^第[^条]+条"
.Global = True: .IgnoreCase = False: .MultiLine = True
For Each i In ActiveDocument.Paragraphs
For Each mt In .Execute(i.Range.Text)
m = mt.FirstIndex: n = mt.Length
Set oRang = ActiveDocument.Range _
(i.Range.Start + m, i.Range.Start + m + n)
oRang.Bold = True
Next
Next
End With
End Sub
|
评分
-
1
查看全部评分
-
|