I'm using Microsoft Word Primary Interop Assemblies to slave MS Word. My application opens up its own Word window (using an instance of Microsoft.Office.Interop.Word.Application). After the app does its thing, I want to close the Word window that I opened, but I don't want to affect other Word windows that the user might have open. If I use Application.Quit then all the Word windows end up closing. If I use Application.ActiveWindow.Close then the word document closes but the Word window that I created still stays open with a blank screen which is undesirable.
How do I tell Word through its API to close the Word instance that I opened without affecting the other instances? This is similar to the behavior when you click the X in the upper right corner of the Word window.
I realize this is a bit of a late fix but this worked for me;
When creating your word application Object, create a temporary Word Object, open that first, then open your proper word document... then close the temporary one.
This may seem like it's wasting space and memory, but what this does is ensure that your created winword.exe stays on it's own, and newly created word docs won't hook into yours.
To reproduce this issue I had to open up word in my application and then open up a separate word via the shortcut (Microsoft office word). When my application called MyWord.Quit() then it would close both documents instances down. The issue is that the newly created document hooks into WINWORD.EXE that your application creates, thus when you close your app down it closes the other document (even though they appear in different instances).
It took me a long time to fix, and i hope it helps others!