kerrypnx
11/20/2018 - 8:33 AM

高亮称谓

revise 11-20

Sub HightAppellation(str As String)
Dim arr, appe, aimT() As String
getAppellation = ""
    arr = "Mr.,Ms.,Dr.,Prof."
    appe = Split(arr, ",")
    For i = 0 To UBound(appe)
        If InStr(str, appe(i)) > 0 Then
            getAppellation = getAppellation + "," + appe(i)
            
        End If
    Next
    
    If getAppellation <> "" Then
        aimT = Split(getAppellation, ",")
        For j = 0 To UBound(aimT)
            With Selection.Range.Find
                .ClearFormatting
                .Replacement.ClearFormatting
                .Text = aimT(j)
                .Wrap = wdFindStop
                .Replacement.Highlight = True
                .Execute Replace:=wdReplaceAll
            End With
        Next
        
    End If
End Sub
Sub authorNameAppella()
    ActiveDocument.Paragraphs(3).Range.Select
    HightAppellation (Selection.Text)
End Sub