This project has moved. For the latest updates, please go here.

Capturing text in a document

Jan 30, 2014 at 11:02 AM
Hi

I have created a 2007 word addin targetting 4.0. How do I create an event that triggers if the user changes the text in a specified location in the document (ie triggers if a single character changes). Then set that text to a string valuable. I was thinking I should use the Selection Class to target the location however I was hoping that there is a specific class/method that targets the user input text event.

Thanks
Jan 30, 2014 at 11:21 AM
Unfortunately there is no straightforward way to do this.

WindowSelectionChange event will be triggered when anything is changed in Word by mouse click or keyboard.
You can hook in to low level keyboard events like this http://blogs.msdn.com/b/toub/archive/2006/05/03/589423.aspx if you are keen only on keyboard press events.