A
andreas.baus
What is the best (most reliable) way to determine which Office
application is hosting an shared addin? In other words, in the
OnConnection method, I just get a reference to a generic object, but if
the addin is supposed to be able to work with either (for example)
Word, Excel or PowerPoint, how do I figure out which of them loaded it
so I can branch to application-specific code wherever necessary?
I tried force casting the object to Word.Application, Excel.Application
etc., catching exceptions until I find a cast that doesn't fail, but
that has the unpleasant side effect that for each failed cast, the
loading of the host application is delayed a small, but noticeable
amount of time. Surely there must be a more elgant way? Thanks in
advance to anyone who can give me some ideas.
application is hosting an shared addin? In other words, in the
OnConnection method, I just get a reference to a generic object, but if
the addin is supposed to be able to work with either (for example)
Word, Excel or PowerPoint, how do I figure out which of them loaded it
so I can branch to application-specific code wherever necessary?
I tried force casting the object to Word.Application, Excel.Application
etc., catching exceptions until I find a cast that doesn't fail, but
that has the unpleasant side effect that for each failed cast, the
loading of the host application is delayed a small, but noticeable
amount of time. Surely there must be a more elgant way? Thanks in
advance to anyone who can give me some ideas.