![]() |
#4
|
|||
|
|||
![]()
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 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!
__________________
Backup your original file before doing any modification. Last edited by eduzs; 07-26-2020 at 05:12 PM. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
cc3125 | Word | 1 | 10-26-2015 06:44 PM |
![]() |
jc491 | Word VBA | 8 | 09-30-2015 06:10 AM |
Find instance of a word in a specific style and change its color | hwg | Word VBA | 7 | 02-20-2014 10:59 PM |
![]() |
Cobb78 | Word | 1 | 05-26-2012 06:16 PM |
How to remove the UNDERLINE from a hyperlink text? | Learner7 | PowerPoint | 3 | 05-17-2010 09:35 PM |