Re: Deriving the word (range) at cursor location
- From: "Jonathan West" <jwest@xxxxxxxx>
- Date: Sun, 3 Dec 2006 18:39:53 -0000
"MAB" <MAB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:4C691747-7A0B-434F-9895-C4E1E12D3EA8@xxxxxxxxxxxxxxxx
Thanks for the help Jonathan & Jay
I was able to expand the selection with the following
l1 = Sel.MoveStart(wdWord, -1)
l2 = Sel.MoveEnd(wdWord, 1)
If Right(Sel.Text, 1) = " " Then l2 = Sel.MoveEnd(wdCharacter, -1)
however I would perfer not to expand the selection. I'd rather calulate a
range instead (how?).
Also, It seems the user cannot change the background color of a word that I
programmatically set early. Do you have any idea why?
The Words collection is a collection of Range objects. Really, do please just *try* Jay's code. You *don't* need to expand the selection in order to get the whole word that contains the selection by means of Selection.Words(1).
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
.
- References:
- Re: Deriving the word (range) at cursor location
- From: Jay Freedman
- Re: Deriving the word (range) at cursor location
- From: Jonathan West
- Re: Deriving the word (range) at cursor location
- Prev by Date: Re: Deriving the word (range) at cursor location
- Next by Date: Re: Deriving the word (range) at cursor location
- Previous by thread: Re: Deriving the word (range) at cursor location
- Index(es):
Relevant Pages
|