View Single Post
 
Old 11-28-2014, 09:28 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Sandhya: You did not specify the removal of only green highlights - you said:
Quote:
Can any one help me to modify the code, this will remove the highlighted text at only one place, but i would like to remove in the whole active document
which means all highlights.

And do you really suppose we need all of your last five posts to tell us basically the same thing? Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .Highlight = True
    .Execute
  End With
  Do While .Find.Found
    If .HighlightColorIndex = wdBrightGreen Then
      i = i + 1
      .HighlightColorIndex = wdNoHighlight
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
MsgBox i & " highlights found & removed."
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote