zoukankan      html  css  js  c++  java
  • close process excell

    #region Kill EXCEL
            //As a safety check go through all processes and make
            //doubly sure excel is shutdown. Working with COM
            //have sometimes noticed that the EXL.Quit() call
            //doesn't always do the job
            private void killExcel()
            {
                try
                {
                    Process[] ps = Process.GetProcesses();
                    foreach (Process p in ps)
                    {
                        if (p.ProcessName.ToLower().Equals("excel"))
                        {
                            p.Kill();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ERROR " + ex.Message);
                }
            }
            #endregion

  • 相关阅读:
    异常处理
    PAT——1048. 数字加密
    PAT——1047. 编程团体赛
    PAT——1046. 划拳
    PAT——1045. 快速排序(25)
    PAT——1044. 火星数字
    PAT——1043. 输出PATest
    PAT——1042. 字符统计
    PAT——1041. 考试座位号
    PAT——1040. 有几个PAT
  • 原文地址:https://www.cnblogs.com/greencolor/p/2095045.html
Copyright © 2011-2022 走看看