我想构建一个允许用户选择以前打开的Excel实例的表单。从进程ID获取打开的xlsx文件名
从那里,我想提取出与该打开的实例关联的.xlsx
文件的名称。
我怀疑我不得不使用COM将它从它那里拿出来,但我还没有找到办法做到这一点。
我想的代码如下:
Process[] openApplications = Process.GetProcessesByName("excel");
foreach(Process p in openApplications)
{
///Find the associated .xlsx path and file
///...Maybe from the handle id?
}
任何帮助,将不胜感激
http://stackoverflow.com/questions/7916711/get-the -current-workbook-object-in-c-sharp –
让我知道如果上述问题解决了您的问题,以便我可以将此问题标记为重复项:D –