VB.NET Excel Program Leaves EXCEL.EXE floating after completion

前端 未结 4 1847
醉酒成梦
醉酒成梦 2020-12-04 01:51

I am writing a program that loops through all of the sheets in an Excel workbook and saves each sheet as its own workbook. It turned out to be a bit trickier than I expected

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-04 02:23

    You might need to do the following if you have unreferenced COM objects that are being created:

    GC.Collect()
    GC.WaitForPendingFinalizers()
    

    Taken from this MSDN forum post: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/cb5f7948-c229-483e-846b-a1cfbbcd86ca/

提交回复
热议问题