Excel关闭后仍然运行 [英] Excel still runing after closing
问题描述
大家好,
我遇到的问题发生在每个项目中(从小到大)。当我创建Excel插件并开始调试时,Excel打开没有问题,但当我关闭Excel时,它仍然是
运行大约20秒,然后关闭。有时我得到"Microsoft Excel已停止工作"错误。
I'm facing a problem that happens in every Project (small to large). When I create a Excel addin and start debugging, Excel opens without problems, but when I close Excel, it remains running for about 20 seconds, then close. Sometimes I got "Microsoft Excel has stopped working" error.
我正在使用Visual Studio Enterprise 2015和Excel 2016。
观看视频:
有没有办法立即关闭程序?
Is there any way in order to shut down the program immediately?
推荐答案
您好,
您是否释放所有基础COM对象立即?
Do you release all underlying COM objects instantly?
使用 System.Runtime.InteropServices.Marshal.ReleaseComObject &bbsp;
在使用完毕后发布Excel对象。 然后s 变量 没什么
C#中)释放对象的引用。
您也可以找到
为什么Excel不退出?文章有用。请注意,如果您开发Excel COM加载项,则无需以编程方式(从加载项)关闭主机应用程序。
Also you may find the Why doesn’t Excel quit? article helpful. Note, if you develop an Excel COM add-in there is no need to close the host application programmatically (from your add-in).
这篇关于Excel关闭后仍然运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!