Stop Microsoft Word re-using WinWord.exe process created via COM Interop

automationcom-interopms-officems-word

If I start an instance of a word application via COM Interop, an instance of Winword.exe is started in the background. If I then subsequently load a Word document from Windows Explorer, it is loaded into the running Winword.exe process that was created via the COM Interop calls.

When my application then closes the COM Interop Application object (because it's done with it), all documents that were loaded into it from Windows Explorer are also shut.

Is there any way to prevent "Native" Microsoft Word from re-using a Winword.exe process that was generated via COM Interop?

Update: Corporate environment so running under another user account isn't feasible.

Update: Word versions range from 2003 on most users machines to 2010 on others.

Update: The workaround described On this KB is only partially adequate as it doesn't work with opening of documents from windows explorer.

Best Answer

There isn't a simple/elegant way to do this. (Atleast not one that I have found in the last few years of looking). But depending on your scenario there might be specific workarounds that fit the bill.

I've resorted to invoking COM Interop for word from an account that is different from the one that real users would login with. That has worked reliably so far.

Would that do the trick for your scenario? If not do share your scenario. Also, what version of Word are you programming against?

Related Topic