This adaptation based on your code works but results in infinite loop
The Exit Do is not working.
Update: the code below does not work if the document have headers.
The document can have words underlined in up to 3 colors or none underlined, one of which is automatic. I need to remove only underlines that are not wdColorAutomatic.
Code:
Set oRng = ActiveDocument.range
With oRng.Find
.Font.Underline = True
.Forward = True
.Wrap = wdFindContinue
.Execute
Do While .Found
If oRng.Font.UnderlineColor <> wdColorAutomatic Then
oRng.Font.Underline = wdUnderlineNone
End If
If .Found = ActiveDocument.range.End Then Exit Do
.Execute
Loop
End With
Update2:
Maybe this is impossible with find/found loop, with for/next loop (each word) I was able to get the task done, but takes a lot of time.
For now I chose to simply remove the entire underline.
Thanks!