kerrypnx
11/20/2018 - 9:33 AM

高亮首字母不大写的实词(表头,标题)

revise 11-20

Sub tableHeaderNoUpperCase()
    Dim c As Cell
    For Each c In Selection.Tables(1).Range.Cells
        c.Select
        If c.Range.Font.Bold = True Then
            FunctionGroup.highlightNoUpperCase
        Else
        Exit Sub
        End If
    Next
End Sub
Sub sectionTitleNoUpperCase()
Dim i As Integer
For i = 1 To 3
Selection.HomeKey wdStory

    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = ""
        .Wrap = wdFindStop
        .ParagraphFormat.OutlineLevel = i
        Do
        .Execute
            If .Found Then
                FunctionGroup.highlightNoUpperCase
            Else
                Exit Do
            End If
        Loop
    End With
Next
End Sub

Function highlightNoUpperCase()

coll = "at,could,due,on,down,right,left,up,till,until,opposite,by,within,throughout,inside,outside,without,but,beside,below,as,the,into,after,before,between,during,from,for,with,to,and,of,or,in"

wordC = Selection.Range.Words.count
Dim i As Integer
    i = 1
    Do While (i < wordC)
       
        aimT = Selection.Range.Words(i).Text
        
        If InStr(coll, Trim(aimT)) = 0 Then
        
            If 96 < Asc(Left(aimT, 1)) And Asc(Left(aimT, 1)) < 121 Then
                Selection.Range.Words(i).HighlightColorIndex = wdRed
            End If
        End If
        
        i = i + 1
    Loop
End Function