Excel PID process casting

R

retsb

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
 
J

Joel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top