我正在编写一个按整个单词查找特定文本并突出显示的子程序。问题是用户希望文本为灰色 (wdGrey25) 而不是默认的黄色。这是我的示例代码:
Public Sub HighlightStrings()
Dim rng As Range
Set rng = ActiveDocument.Range(Start:=0, End:=0)
With rng.Find
.Forward = True
.Wrap = wdFindStop
.MatchWholeWord = True
.Text = "Claimant's name"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
.Text = "date"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
.Text = "he/she"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
.Text = "describe incident"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
.Text = "describe condition(s)"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
.Text = "describe occupational disease"
.Replacement.Highlight = True
.Execute Replace:=wdReplaceAll
End With
End Sub
到目前为止,它可以完美地找到和突出显示,而不会像以前的版本一样丢失对齐和定位,但是突出显示颜色对于我们的老用户来说太痛苦了,无法查看。有人解决了吗?
提前致谢,-C§