none
How to get the word under mouse cursor ? RRS feed

  • Question

  • Is there a common way to get the word under mouse in Office productions?

    Is there an interface?  (at least in Word)

    Thank you!

    • Edited by Raptor K Thursday, September 20, 2012 8:26 AM
    Thursday, September 20, 2012 8:25 AM

Answers

  • Hi Raptor K

    The only thing Word has in this regard is the RangeFromPoint method, that's basically a Windows API function that's been made available to VBA. "Your mileage may vary" when using it.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Raptor K Tuesday, September 25, 2012 1:14 PM
    Tuesday, September 25, 2012 8:24 AM
    Moderator

All replies

  • Hi Raptor K,

    Based on your issue , I think the Application.Selection Property is what you are looking for.

    Please refer to http://msdn.microsoft.com/en-us/library/office/ff838682.aspx

    Hope it helps.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, September 21, 2012 5:55 AM
    Moderator
  • Thank you ,but Application.Selection works only when text is selected.

    I want to get the word when the mouse pointer hover above it.  Like dictionary software.

    • Edited by Raptor K Tuesday, September 25, 2012 6:11 AM
    Tuesday, September 25, 2012 6:09 AM
  • Hi Raptor K,

    It's based on my experience that there is no an interface in Word to support for your objective.

    You can refer to Word 2010 Developer Reference

    I also hope in future version of word more advanced APIs will come up.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, September 25, 2012 8:24 AM
    Moderator
  • Hi Raptor K

    The only thing Word has in this regard is the RangeFromPoint method, that's basically a Windows API function that's been made available to VBA. "Your mileage may vary" when using it.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by Raptor K Tuesday, September 25, 2012 1:14 PM
    Tuesday, September 25, 2012 8:24 AM
    Moderator