Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
How do I stop confirm deletion of highlighted text | Microsoft Word Help | |||
My text is highlited and I hit backspace, why no deletion? | Microsoft Word Help | |||
how to switch of text deletion when correcting in word | Microsoft Word Help | |||
Automating deletion of text blocks using buttons. | Microsoft Word Help | |||
Hide Confirmation box for text deletion | New Users |