<p>I want to write a word addin that does some computations and updates some ui whenever the user types something or moves the current insertion point. From looking at the MSDN docs, I don't see any obvious way such as an TextTyped event on the document or application objects.</p>

<p>Does anyone know if this is possible without polling the document?</p>

[{'answer_id': 55868, 'author': 'Wayne Kao', 'author_id': 3284, 'author_profile': 'https://Stackoverflow.com/users/3284', 'pm_score': 2, 'selected': True, 'text': '<p>As you\'ve probably discovered, <a href="http://msdn.microsoft.com/en-us/library/aa269681(office.10).aspx" rel="nofollow noreferrer">Word has events</a>, but they\'re for really coarse actions like a document open or a switch to another document.  I\'m guessing MS did this intentionally to prevent a crappy macro from slowing down typing.</p>\n\n<p>In short, there\'s no great way to do what you want.  <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.office.developer.com.add_ins&amp;tid=4c3e438e-d9ab-4384-b29c-105175fd252e&amp;cat=&amp;lang=&amp;cr=&amp;sloc=&amp;p=1" rel="nofollow noreferrer">A Word MVP confirms that in this thread.</a></p>\n'}, {'answer_id': 1033966, 'author': 'Sebastian Bender', 'author_id': 96671, 'author_profile': 'https://Stackoverflow.com/users/96671', 'pm_score': 2, 'selected': False, 'text': '<p>Actually there is a way to run some code when a word has been typed, you can use SmartTags, and override the Recognize method, this method will be called whenever a word is type, which means whenever the user typed some text and hit the space, tab, or enter keys.</p>\n\n<p>one problem with this however is that if you change the text using "Range.Text" it will detect it as a word change and call the function so it can cause infinite loops.</p>\n\n<p>Here is some code I used to achieve this:</p>\n\n<pre><code>public class AutoBrandSmartTag : SmartTag\n{\n    Microsoft.Office.Interop.Word.Document cDoc;\n\n    Microsoft.Office.Tools.Word.Action act = new Microsoft.Office.Tools.Word.Action("Test Action");\n\n    public AutoBrandSmartTag(AutoBrandEngine.AutoBrandEngine _engine, Microsoft.Office.Interop.Word.Document _doc)\n        : base("AutoBrandTool.com/SmartTag#AutoBrandSmartTag", "AutoBrand SmartTag")\n    {\n        this.cDoc = _doc;\n\n        this.Actions = new Microsoft.Office.Tools.Word.Action[] { act };\n    }\n\n    protected override void Recognize(string text, Microsoft.Office.Interop.SmartTag.ISmartTagRecognizerSite site, \n        Microsoft.Office.Interop.SmartTag.ISmartTagTokenList tokenList)\n    {\n        if (tokenList.Count &lt; 1)\n            return;\n\n        int start = 0;\n        int length = 0;\n        int index = tokenList.Count &gt; 1 ? tokenList.Count - 1 : 1;\n\n        ISmartTagToken token = tokenList.get_Item(index);\n\n        start = token.Start;\n        length = token.Length;\n    }\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/55735', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2925/']