获取已打开多个的EXCEL操作

【背景】南方CASS软件打开几千个EXCEL表格(都是新建的,还没保存),它们的特点是:一个excel在进程中表现为一个exccel进程,现在想以第一个工作表作为名称保存所有excel。
使用System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")只能获取第一个excel进程,于是我遍历进程,处理一个关闭一个,具体代码是:
private void btnSave_Click(object sender, EventArgs e)
{
Process[] pl = Process.GetProcesses();
for (int i = 0; i < pl.Length; i++)
{
try
{
if (pl[i].ProcessName.ToLower()=="excel")
{
MessageBox.Show(pl[i].Id.ToString());
Microsoft.Office.Interop.Excel.Application ap = (Microsoft.Office.Interop.Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
MessageBox.Show(ap.Workbooks.Count.ToString());//问题表现
for (int j = 1; j <= ap.Workbooks.Count;j++ )
{
Microsoft.Office.Interop.Excel.Workbook book = ap.Workbooks[j];
if (book != null)
{
//MessageBox.Show(book.Name);
fileName = ((Microsoft.Office.Interop.Excel.Worksheet)book.ActiveSheet).Name;
book.SaveAs(filePath + fileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
}
}
ap.Quit();
pl[i].Kill();
}
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message + "\n" + ex.StackTrace + "\n" + ex.Source + "\n" + ex.TargetSite);
}
}
}
【问题】但这样的问题在于有时候能成功处理,有时候又不行,原因是有时excel进程Workbooks.Count=0,感觉是关闭进程的问题,求大神指出问题在哪里,或者给出其他解决方案。