Solution Environment:
MS Visual Studio 2010 Ultimate, MS Office 2010 Professional, Microsoft Interop Classes
Scenario:
I created a .Net application that uses Interop classes to interact with MS Word. Consider this: an application that simulates a table of key-value pairs. When the user clicks on the "value" field, the .net application opens a winword window in which the user can enter some notes. When you click on the close (winword) .net application will execute winword.wordopenxml and save the data in the field. To make this happen, I added event handlers to winword. The application works fine. The problem occurs when I have several winword instances open (separately by the user, but not through the .net application). Event handlers from the .net application are applied to all instances of winword and, therefore, when closing only one instance word, all other instances are also closed. I tried different ways to initialize the word object in the application. I also tried the work “Initializing two instances of winword and exiting the first instance” → This approach also did not help.
Guru: Could you help me find a suitable solution for this problem?
-Rupesh
source share