View Single Post
  #14   Report Post  
Posted to microsoft.public.word.newusers
Anthony Giorgianni Anthony Giorgianni is offline
external usenet poster
 
Posts: 4
Default Macro for highlighting

Thanks Tony

But without using Sendkey, I can't figure out how simply to turn on
highlighting without selecting anything first. Am I missing something?


--
Regards,
Anthony Giorgianni

The return address for this post is fictitious. Please reply by posting back
to the newsgroup.

"Tony Jollans" My forename at my surname dot com wrote in message
...
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.