0

我正在尝试突出显示所有单词,但目前它是在区分大小写的基础上进行的,我想避免这样做。

Sub Highlight_words()
    Dim range As range
    Dim i As Long
    Dim TargetList

    TargetList = Array("Array", "highlight", "With", "range", "matchcase")
        ' put list of terms to find here

    For i = 0 To UBound(TargetList)

        Set range = ActiveDocument.range

        With range.Find
            .Text = TargetList(i)
            .Format = True
            .MatchCase = True
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False

            Do While .Execute(Forward:=True) = True
                range.HighlightColorIndex = wdYellow
            Loop
        End With
    Next
End Sub
4

1 回答 1

2

将 .MatchCase = true 更改为以下内容:

.MatchCase = False

干杯

于 2013-08-14T14:47:16.343 回答