View Single Post
  #13   Report Post  
Posted to microsoft.public.word.newusers
Tony Jollans Tony Jollans is offline
external usenet poster
 
Posts: 1,308
Default Macro for highlighting

Whilst that may work for you ...

* most people don't have F10 - or any key - assigned to highlighting
* Sendkeys is generally best avoided

If you use the explicit statement (Selection.Range.HighlightColorIndex =
wdRed) that Lene and I have both suggested you will find it works just as
well. The only difference (which you'll generally be unaware of) is that it
will work when Sendkeys would have failed, and also that it will work for
other people as well.

--
Enjoy,
Tony

"Anthony Giorgianni" wrote in message
...
Thanks Tony.

I found the problem. On my old laptop, I must have assigned F5 to turn on
hgihlighting. So when I transferred the macro to my new laptop with
"Sendkey" F5, it didn't trigger the highlighter but instead ran Find and
replace, the assignment for f5 on that machine :O)

Now it works fine with:

Sub HighLight_Red()
Selection.Range.HighlightColorIndex = wdRed
SendKeys "(F10)"

With F10 now assigned to turn on highlighting.

End Sub

Thanks again to you and Lene.

Regards,
Anthony Giorgianni

For everyone's benefit, please reply to the group.