【问题标题】:Highlighting words in Word 2013 but not case sensitive在 Word 2013 中突出显示单词但不区分大小写
【发布时间】:2013-08-16 14:03:01
【问题描述】:

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

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

【问题讨论】:

    标签: vba ms-word highlight


    【解决方案1】:

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

    .MatchCase = False
    

    干杯

    【讨论】:

      猜你喜欢
      • 2023-03-06
      • 2011-02-14
      • 2018-02-28
      • 2015-06-11
      • 2013-10-04
      • 2015-08-30
      • 1970-01-01
      • 2011-03-18
      • 2015-12-19
      相关资源
      最近更新 更多