![]() |
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 |
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 |
All times are GMT +1. The time now is 04:17 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com