"Reading Highlight" command

J

John HB

I wanted to run a macro that ended by highlighting certain terms in the
document. The most obvious solution would seem to be to use the new "Reading
Highlight" feature of Word 2007. Does anybody know the code for this?

When I record a macro and click reading highlight in the find box, the macro
does not record any command for this.

Thanks!
John
 
S

Stefan Blom

In the simplest form:

ActiveDocument.Content.Find.HitHighlight FindText:="text to find here"

And to clear the highlighting, use:

ActiveDocument.Content.Find.ClearHitHighlight.
 
J

John HB

This is perfect. Would it be possible to let me know the command that is the
equivalent of "find all", or in Word 2007 "Find in - Main document", the one
that leads to all of a the find what text being "selected" in the document?

Many thanks
 
S

Stefan Blom

Sorry, I can't answer that one. VBA does not handle multiple selections very
well, which is why I suspect that there is no code equivalent for "find
all," but I really don't know.
 
S

Stefan Blom

But, of course, you can use VBA to replace or reformat the found text;
there's really no need to select it.
 
J

John HB

Thank you. The reason I want select all is quite strange - let me explain:

I want to search in the text for all instances of text surrounded by
brackets, and then highlight the text with track changes on in such away that
the highlighting will appear as revisions.

Of course, I thought I could just find and replace for text between
brackets, but if you do that with track changes on, then it shows the actual
text as being deleted and readded next to it, not just as being highlighted.

Thank you,
John
 

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