Catch opened word file event -


i want make application word add-in changes files when opened.

so created word add-in project in visual studio, , code have :

namespace wordaddin1 {     public partial class thisaddin     {      private void application_documentopen(microsoft.office.interop.word.document doc)     {     messagebox.show("doc opened");     // stuff     }      #region vsto generated code      /// <summary>     /// required method designer support - not modify     /// contents of method code editor.     /// </summary>     private void internalstartup()     {         this.application.documentopen += new word.applicationevents4_documentopeneventhandler(application_documentopen);     }      #endregion } } 

the problem is, works if start empty word application (double click word.exe), open document, not if word application started document opening (double click .doc file).

the documentopen won't fire if open word double-clicking on document.

to work around can check if document opened in word , if pass document application_documentopen method.

btw - seem have changed code in internalstartup method. indicated comments should not this, instead uses thisaddin_startup.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -