View Single Post
 
Old 08-17-2023, 01:24 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, try this:


Code:
Sub FindYellowText()

Dim oSel As range
Dim oResponse As Document

    Set sel = ActiveDocument.range
    Set oResponse = Documents.Add
    
    With sel.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = ""
        .MatchWildcards = False
        .Forward = True
        .Wrap = wdFindStop
        .Font.ColorIndex = wdYellow
        .Execute
        Do Until Not .found
            If sel.Font.ColorIndex = wdYellow Then
                sel.Cut
                With oResponse
                    selection.range.Paste
                    selection.MoveStart unit:=wdParagraph
                    selection.TypeParagraph
                End With
            End If
            .Execute
        Loop
    End With
End Sub
Reply With Quote