title: VSTO Ribbons and Interop
body: <p>Is it possible to handle button click events on a custom ribbon button from another application using interop?</p>
  
  <p>So if I've created a Word 2010 application add-in which creates a custom tab with several buttons and then I instantiate a Word application from a C# win forms application using interop, how would I then go about wiring up to the button click events on my custom ribbon from the win forms app? With Word 2003 I could access the buttons through the CommandBars collection and then simply wire up to the click event.</p>
  
  <p>After some further reading, I guess what I'm trying to do is find out how to get access to the Ribbon object model using interop. Is this possible? </p>
  
  <p>[Edit]</p>
  
  <p>For anyone that's interested. When I wrote this question I knew of another way to solve my problem, but it means a lot of extra work changing my existing implementation to upgrade from Office 2003 to Office 2010, and so I was hoping there would be away to access the Ribbon object model outside of a VSTO add-in.</p>
  
  <p>My solution is to use an IpcChannel to make calls from the vsto add-in to my win-forms application. So my win-forms application initialises the Word instance and then opens up a server channel. In the vsto add-in I handle Application.DocumentOpen and if the document is owned by my application I open a client channel to my application. I can then make calls back to my win-forms app from the vsto add-in through the use of shared interfaces.</p>
  
  <p>While this technique works, it does have some draw backs. If the calls through the ipc channel are synchronous then my application can't touch the word object because a deadlock occurs. Making asynchronous calls introduces other problems, but I found that I could block the Word window with a modal dialog without ending up deadlocked.</p>
  
  <p>While this isn't an exact answer to my original question, it is an alternative and so I thought I would share this with anyone else having this problem.</p>
  
  <p>If anyone does know how to access the Ribbon object model outside of VSTO I would still be interested to know how.</p>