Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Get word on right click

$
0
0

Hello,

I have the following code:

Word.Selection selection = Globals.ThisAddIn.Application.Selection;
if (selection != null && !String.IsNullOrEmpty(selection.Text))
{
   string selectionText = selection.Text;
   System.Windows.Forms.MessageBox.Show(selectionText);
}

This code shows a message box with the selected text when I right-click on it.

My question is, how can I make it work without having to have the word selected, but still show the word it was clicked on - just like synonyms and definition works.

Thank you


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>