View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] retsb@nrcan.gc.ca is offline
external usenet poster
 
Posts: 2
Default Excel PID process casting

I have an Excel workbook that launch an external .exe. My .exe is
written in c#. My application need a reference to the excel
applicationthat just call it. When calling the external .exe (my c#
application) from Excel, i'm passing the Excel PID in arguments. In c#
i'm able to get the Excel process with Process.GetProcessById(pid) but
i don't know how to cast it back to an Excel application Object. ex :
appExcel = (Excel.Application)(Process.GetProcessById(pid)) this
doesn't work.

I need something like that but with the process pid :
appExcel =
(Excel.Application)Marshal.GetActiveObject("Excel. Application");

Thanks,
Tommy