Get Excel.Application object from Process or hwnd in .NET

Posted by Abiel on Stack Overflow See other posts from Stack Overflow or by Abiel
Published on 2010-06-08T04:26:42Z Indexed on 2010/06/08 4:32 UTC
Read the original article Hit count: 243

Filed under:
|

In C# I am trying to get an instance of an Excel.Application object from a Process object. This seems like it should be really simple yet I cannot figure it out and cannot find an example. To repeat, I have a System.Diagnostics.Process object that I know refers to a running Excel instance. I now need to recover a Microsoft.Office.Interop.Excel.Application object that refers to the process so that I can go about manipulating the Excel application from C#.

In case it makes it any simpler, I also have the HWND id and window text associated with the active Excel window.

Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about excel