|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 转中间汉字为黑色2()
Dim regx As Object, mth
sstr = ")("
Set regx = CreateObject("vbscript.regexp")
regx.Global = True
regx.Pattern = "\)[一-﨩]+\("
For Each mth In regx.Execute(ActiveDocument.Content)
k = mth.FirstIndex: c = mth.Length
With ActiveDocument.Range(k, k + c)
.Font.Name = "楷体" '"楷体"
.Start = .Start + 1
.End = .End - 1
.Font.ColorIndex = 1 '1,黑色;2,蓝色;3,天兰;4,绿色;5,红色;6,红色;7,黄色;8,白色
End With
If InStr(ActiveDocument.Range(k, k + c), ")") <> 0 Then
With ActiveDocument.Range(k, k + c).Characters(InStr(ActiveDocument.Range(k, k + c), ")"))
.Font.Name = "方正姚体"
.Font.ColorIndex = 2
End With
End If
If InStr(ActiveDocument.Range(k, k + c), "(") <> 0 Then
With ActiveDocument.Range(k, k + c).Characters(InStr(ActiveDocument.Range(k, k + c), "("))
.Font.Name = "方正姚体"
.Font.ColorIndex = 2
End With
End If
Next
End Sub |
评分
-
1
查看全部评分
-
|