Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2014, 06:01 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Default search for the highlighted text

Quote:
Originally Posted by Stefan Blom View Post
To remove all highlighting in the main body of the document at once, use the following line of code:



Code:
ActiveDocument.Content.HighlightColorIndex = wdNoHighlight

Thanks for you suggestion,

when i trying to find the highlighted text it is not finding.?
Reply With Quote
  #2  
Old 11-27-2014, 06:02 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Default serach for the highlighted text

When i am searching for the highlighted text through coding it is not finding. please suggest.
Reply With Quote
  #3  
Old 11-27-2014, 08:31 PM
macropod's Avatar
macropod macropod is offline search for the highlighted text Windows 7 64bit search for the highlighted text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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: Please don't try to hijack other peoples' threads. I've moved your post from the other thread to this one.

The first post (above) has nothing to do with finding highlighted text. It simply removes highlighting - but you don't even need a macro for that.

As for finding highlighted text, you can do that via a simple Find operation, where 'Highlight' is specified as a Find parameter. If you want that for a macro, simply record the action with the macro recorder.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-28-2014, 07:08 AM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Talking remove highlight in whole document

Hi,

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.

Sub SearchAnyHighlight()
Dim hiliRng As Range
Set hiliRng = ActiveDocument.Content
With hiliRng.Find
.Highlight = True
.Execute
If hiliRng.Find.Found Then
MsgBox "You can't close Active Document"
Do While hiliRng.Find.Execute
If hiliRng.HighlightColorIndex = wdBrightGreen Then
hiliRng.HighlightColorIndex = wdNoHighlight
End If
Loop
End If
End With
End Sub
Reply With Quote
  #5  
Old 11-28-2014, 06:36 PM
macropod's Avatar
macropod macropod is offline search for the highlighted text Windows 7 64bit search for the highlighted text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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: I have asked you before to not keep starting new threads on the same topic. Keep it up and your account will be closed.

Furthermore, the first post in this thread (to which I've merged your latest post) already shows how to remove highlighting from an entire document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 11-28-2014, 07:33 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Default

Hi friend,

I question is to remove only that specified highlighted color i.e. "wdBrightGreen", where as per your suggestion if give the same it if remove all the highlighted things.
Reply With Quote
  #7  
Old 11-28-2014, 07:35 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Default

Hi,

I am sorry for the inconvenience as per your suggestion it will undo all the highlited things, but i question is to remove only specified highlighted color in entire document.

Kindly help me.
Reply With Quote
  #8  
Old 11-28-2014, 07:38 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Unhappy

Quote:
Originally Posted by macropod View Post
Sandhya: I have asked you before to not keep starting new threads on the same topic. Keep it up and your account will be closed.

Furthermore, the first post in this thread (to which I've merged your latest post) already shows how to remove highlighting from an entire document.

Hi,

My question is to remove only specified highlited color not all the highlits.

Kindly help me.
Reply With Quote
  #9  
Old 11-28-2014, 07:39 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Sandhya: I have asked you before to not keep starting new threads on the same topic. Keep it up and your account will be closed.

Furthermore, the first post in this thread (to which I've merged your latest post) already shows how to remove highlighting from an entire document.
As per your suggestion it will undo entire document, but my question is to undo or remove specified highlighted color.

Please hlep me..............
Reply With Quote
  #10  
Old 11-28-2014, 07:41 PM
Sandhya Sandhya is offline search for the highlighted text Windows 7 32bit search for the highlighted text Office 2007
Novice
search for the highlighted text
 
Join Date: Nov 2014
Posts: 21
Sandhya is on a distinguished road
Unhappy

Quote:
Originally Posted by Sandhya View Post
Thanks for you suggestion,

when i trying to find the highlighted text it is not finding.?
Hi friend,

As per your suggestion it wil undo entire document... but i required only specified color to be undo in entire document.

Kindly help me.
Reply With Quote
  #11  
Old 11-28-2014, 09:28 PM
macropod's Avatar
macropod macropod is offline search for the highlighted text Windows 7 64bit search for the highlighted text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
search for the highlighted text Copy paste highlighted text to another doc MSoffice1 Word VBA 17 04-16-2022 06:45 AM
Undo highlighted text rohanrohith Word VBA 1 11-27-2014 04:02 PM
search for the highlighted text W2013: text search results not highlighted in scrollbar perevodchiki-moskva.ru Word 3 05-01-2014 09:13 PM
search for the highlighted text Formatting- Apply changes to highlighted text results in same change to other text sential Word 6 01-10-2014 03:22 PM
search for the highlighted text Remove highlighted text when inserting comments Iammuffinman Word 3 01-27-2011 02:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft