View Single Post
 
Old 04-19-2025, 12:09 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,143
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

There are no 'lines' in a Word document. The following will highlight text formatted as wdColorAutomatic
Code:
    With Selection.Find
        .ClearFormatting
        .Font.Color = wdColorAutomatic
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        Do While .Execute
            Selection.Range.HighlightColorIndex = wdYellow
        Loop
    End With
If by line you mean paragraph then use the following instead to highlight paragraphs that are all formatted as wdAuto
Code:
Dim oRng As Range
Dim oPara As Paragraph
    For Each oPara In ActiveDocument.Paragraphs
        If oPara.Range.Font.ColorIndex = wdAuto Then
            oPara.Range.HighlightColorIndex = wdYellow
        End If
    Next oPara
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote