EXCEl释放

            WB.Save();
            WB.Close(Type.Missing, Type.Missing, Type.Missing);
            appold.Quit();  //应用程序推出,但是进程还在运行


            appnewbook.Save();
            appnewbook.Close(Type.Missing, Type.Missing, Type.Missing);
            appnew.Quit();  //应用程序推出,但是进程还在运行

            System.Runtime.InteropServices.Marshal.ReleaseComObject(worksheet);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(appnewsheet);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(WB);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(appnewbook);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(appold);
            System.Runtime.InteropServices.Marshal.ReleaseComObject(appnew);
原文地址:https://www.cnblogs.com/jhabb/p/2854329.html