View Single Post
 
Old 07-26-2020, 07:08 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

1. Find/remove underline with specific color?


2. Is there a way .... which underline color is <> wdColorAutomatic

Those are two separate questions.



Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Font.UnderlineColor = wdColorRed
    While .Execute
      oRng.Font.Underline = wdUnderlineNone
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub

Sub ScratchMacroII()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Font.Underline = True
    While .Execute
      If oRng.Font.UnderlineColor <> wdColorAutomatic Then
        oRng.Font.Underline = wdUnderlineNone
      End If
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote