|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 duquancai 于 2017-2-25 15:50 编辑
Sub 查找红色黄色突出显示字符替换为粉红色突出显示字符()
Dim mt, n&, m&, oStr$, reg As Object
oStr = Replace(ActiveDocument.Content, Chr(7), "")
Set reg = CreateObject("vbscript.regexp")
reg.Global = True: reg.Pattern = "▲"
For Each mt In reg.Execute(oStr)
m = mt.FirstIndex: n = mt.Length
With ActiveDocument.Range(m, m + n)
If .HighlightColorIndex = wdRed Then
.HighlightColorIndex = wdBlue
.Font.Color = wdColorWhite '字体颜色=白色(此语句为了显示效果清晰,故设为白色)
.Text = "★"
End If
End With
Next
End Sub
|
|