Search for Highlight Color?

A

Alisa Limvere

Is there a way to search for a specific highlight color?
For example, search for yellow highlight vs. light blue
highlight.

As always, thanks for your help.

Alisa
 
D

Dave Lett

Hi Alisa

While you cannot search for the specific color, you can search for highlighting and then test its color, as in the following

With Selection.Fin
.Text = "
.Highlight = Tru
Do While .Execut
Select Case Selection.Range.HighlightColorInde
Case wdYello
MsgBox "Yellow.
Case wdBlu
MsgBox "Blue.
Case Els
MsgBox "Some other color.
End Selec
Loo
End Wit

HTH
Dave
 
A

Alisa Limvere

That's great! I'm trying to come up with a way to test
for "conditional" text and then remove it so I can have a
single source document for multiple audiences. For
example, use yellow highlight for audience1, blue for
audience2, etc. On output, test if book goes to audience1
(probably through input bookmark), then delete blue
highlighted text (or vice versa).

I was thinking of using highlight colors because they are
independent of style settings, tables, etc.

Any suggestions?

Alisa
-----Original Message-----
Hi Alisa,

While you cannot search for the specific color, you can
search for highlighting and then test its color, as in
the following:
 
D

Dave Lett

Hi Alisa

Instead of Highlighting, which we can see is clumsy, create two additional styles (audience1 and audience2). When you go to output, you can hide the style by 1) find/replace OR 2) modify the style definition and update

Testing for the color of the highlight makes the routine slowish. If you know the style name, you can do a global replace

HTH
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top