Get Excel.Application object from Process or hwnd in .NET
- by Abiel
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.