Why not try it, rather than guessing?
The code I gave you will select the word containing the selection, even if the selection is a single point. So if your cursor is within the word crow (eg between the letters "r" and "o") sel.Words(1) will return "crow". If your cursor is not within a word then you have to do a little more work, extending the range either forward or backward: which direction depends on the logic of what you're doing.
"Kaustav" <Kaustav[ at ]discussions.microsoft.com> wrote in message news:7899F138-67F1-431E-86F2-62AEF32CA3AB[ at ]microsoft.com...
[Quoted Text] > Hi Jezebel, > > will this be applicable only if I have selected some text. My scenario is > that I have a sentence like - "This is brown crow" and my cursor is at the > end of the word crow. Now if I right click at that position, how do I get > the > word "crow" or if I place the mouse between the letters "r" and "o" of the > word "crow" and then do a right click, how do I still manage to retrieve > the > word "crow". > > Word is able to do this. What I would like to know is how it does this? > What > does it expose for this functionality? > > Thanks. > > "Jezebel" wrote: > >> Sel.Words(1) >> >> >> >> "Kaustav" <Kaustav[ at ]discussions.microsoft.com> wrote in message >> news:DEAE14E1-6E8E-4275-AAE7-A1BBBD5765BF[ at ]microsoft.com... >> > Hi, >> > >> > How can I get the word in a MS Word document when we right click the >> > mouse >> > on it or when the cursor is at the word's end. I am not selecting the >> > word >> > out here. >> > >> > It is like similar to what MS Word offers when we right click any word >> > and >> > select "Lookup" from the context menu or use "Spell Check" for it. >> > >> >> >>
|