I\'m developing a Word 2007-2010 addin using VSTO in Visual Studio 2008. In my addin, I need a custom task pane for each open word document. Basically, I need to create a ta
Some things to try::
Maybe you can check "Word.Application.Documents.Count" in the DocumentNew- and DocumentOpen-Event to track the actual open document.
To find out if a document is already open (maybe relevant for re-open active document), you can use a dictionary of open documents. The key can the unique document name.
Instead of your IsWindowAlive() method you can maybe catch the Disposed-Event as follows
_vstoDocument.Disposed += _vstoDocument_Disposed;
void _vstoDocument_Disposed(object sender, EventArgs e)
{
//Remove from dictionary of open documents
}