Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Lola Lola is offline
external usenet poster
 
Posts: 4
Default Selection and Deletion of Highlighted Text

I have a large document that multiple users will use as a template.
Depending on their use, they will need to delete certain passages of text.
Each passage is highlighted a different color. Is there a macro that can
delete certain highlighted colors?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Selection and Deletion of Highlighted Text

On Mon, 4 Aug 2008 12:36:35 -0700, Lola wrote:

I have a large document that multiple users will use as a template.
Depending on their use, they will need to delete certain passages of text.
Each passage is highlighted a different color. Is there a macro that can
delete certain highlighted colors?


You can use a series of macros, one for each color, built on this example:

Sub DeleteYellowHighlightText()
Dim oRg As Range
Set oRg = ActiveDocument.Content
With oRg
.Find.Highlight = True
While .Find.Execute
If .HighlightColorIndex = wdYellow Then
.Delete
End If
Wend
End With
End Sub

The only things that need to change from one macro to the next are the name (for
example, Sub DeleteGreenHighlightText) and the value of the HighlightColorIndex
to test (for example, wdGreen).

It would be possible to make a more complex macro in which the user could choose
the color to be deleted, and then need only one macro; but a custom toolbar with
a separate button for each color would probably be easier for most people to
use.

The one drawback of this sort of macro is that it can't be undone with a single
click of the Undo button -- there will be an entry in the Undo list for each
range that was deleted. Again, with some additional programming complexity, that
could be fixed.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I stop confirm deletion of highlighted text Iain Microsoft Word Help 4 October 26th 06 05:25 PM
My text is highlited and I hit backspace, why no deletion? bigpoppa Microsoft Word Help 1 May 17th 06 01:19 AM
how to switch of text deletion when correcting in word zardoz Microsoft Word Help 2 October 4th 05 07:40 PM
Automating deletion of text blocks using buttons. MCB Microsoft Word Help 1 August 25th 05 07:51 PM
Hide Confirmation box for text deletion Alan New Users 3 March 3rd 05 09:45 PM


All times are GMT +1. The time now is 05:33 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"