View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Excel PID process casting

Not sure what you are trying to do. Are your trying to set up a pipe? Maybe
a better approach is to use a semiphore to synchronize the two processes and
transfer data. Use a file to act as the semiphore.

" wrote:

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