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

Thanks Tony

You're right. I did not understand that difference between the two lines.
But I'm still not certain.

What then would be the sequence to create a taskbar button (say a red box,
for example) that, when clicked, would

1) Change the highlight button to red
2) Turn on red highlighting so that:
a) Highlighted text would turn red or
b) if no text is highlighted, simply turn on red highlighting so
that I can highlight as I read by dragging my cursor across unhighlighted
text?

Right now I'm using:

1) Options.DefaultHighlightColorIndex = wdRed (to select red and turn any
selected text to red)
2) SendKeys "{F10}" (to turn on highlighting - where my computer has been
set to use F10 to turn on highlighting).

I think you are right. It would be better not to use the sendkeys command
(especially if I want to move the macro to another computer). But I'm not
sure of the sequence that will avoid using sendkeys.

Sorry if I'm being obtuse. I'm not very familiar with VB.

Thanks.

Regards,
Anthony Giorgianni

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

"Tony Jollans" My forename at my surname dot com wrote in message
...
There are two (VBA) statements that you seem to be confusing or
misunderstanding:

1. Selection.Range.HighlightColorIndex = wdRed

This highlights the selection without affecting the toolbar button - and
is the one to use to avoid sendkeys.

2. Options.DefaultHighlightColorIndex = wdRed

This changes the toolbar button (which then allows the sendkeys to use it
to get the chosen colour) but does not affect the text.

--
Enjoy,
Tony