kerrypnx
11/28/2018 - 9:50 AM

检测QQ 邮箱和雅虎中国邮箱

revise 11-28

Sub existQQYahoo()
  Dim myrange As New myrange
  Dim frontRange As Range
  Set frontRange = myrange.frontPart
   frontRange.Select
   If InStr(Selection.Text, "@qq") > 0 Then
        Selection.HomeKey wdStory
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = "@qq"
            .MatchWildcards = False
            .Replacement.Text = ""
            Do
            .Execute
                If Not .Found Then
                    Exit Do
                Else
                    Selection.Range.HighlightColorIndex = wdRed
                End If
            Loop
        End With
   End If
   
      If InStr(Selection.Text, "@yahoo") > 0 Then
        Selection.HomeKey wdStory
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = "@yahoo"
            .MatchWildcards = False
            .Replacement.Text = ""
            Do
            .Execute
                If Not .Found Then
                    Exit Do
                Else
                    Selection.Range.HighlightColorIndex = wdRed
                End If
            Loop
        End With
   End If
End Sub