无法在以下功能中发布Excel对象:
public void RunM(string fileName, string sMacro)
{
Excel.Application xlApp = null;
Excel.Workbooks Books = null;
Excel.Workbook book = null;
xlApp = new Excel.Application();
Books = xlApp.Workbooks;
book = Books.Open(fileName);
object misValue = System.Reflection.Missing.Value;
book.Application.Run(sMacro);
xlApp.DisplayAlerts = false;
book.Save();
book.Close(false, Type.Missing, Type.Missing);
xlApp.Quit();
GC.Collect();
if (book != null) Marshal.ReleaseComObject(book);
if (Books != null) Marshal.ReleaseComObject(Books);
if (xlApp != null) Marshal.ReleaseComObject(xlApp);
}