Hi Sachin,
OK, yes, I do recognize this scenario. The problem has to do with how most
Office applications are tracked in the Windows (COM) ROT (table of running
applications).
The Office applications were designed to run a single instance, only, by
default. If Word receives on other instructions (and the end-user has no
options for this), it will open every document in the same application
instance. So if you've started an instance and the user chooses to open a
document, the user will pick up your instance.
The most usual way around this is for you to start *two* instances and use
only the second one. The ROT registers only the first instance. So when the
user opens a document, he will link to that first instance (that your
application is not using).
But keep in mind that this is COM - you will have to manage your objects
(the instances) very carefully and remember to destroy them both.
Otherwise, you'll be leaving "orphaned", invisible instances of WinWord.exe
in memory (which will leak resources like a bathtub drain).
You may find this set of articles useful
How To Attach to a Running Instance of an Office Application
http://support.microsoft.com/kb/238975/en-us
PRB: Visual C# .NET Error Attaching to Running Instance of Office
Application
http://support.microsoft.com/kb/316125/en-us
BUG: Starting Word Manually Uses Same Instance as Automation
http://support.microsoft.com/kb/188546/
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail