I may be the only person still automating excel this way and I am looking at doing it in ways that better handle COM objects and such, but for now I just import Microsoft.Office.Interop.Excel and go for it. Something that gave me a lot of grief at first was hanging excel.exe processes, but there are tons of resources online for fixing that. At this point I am pretty confident in my abilities to handle it.
One thing I did notice and was wondering about is how does closing a windows forms application interact with excel.exe running in the background and likely more specifically the garbage collector. I have written quite a few excel automation projects and noticed that after I run my program .exe and it has completed there is an excel.exe process that hangs on until I close the pop up window from the windows forms application. Why is that happening?
Does vb.net not call garbage collect until after the window is closed? Looking at the code I write there is no reference to an "on close of application window" event and the garbage collector and release COM objects calls are all right in the code, so it seems curious to me that after the code has executed (which I take to mean garbage collect has been called, as in the code) there is an excel.exe process that stays up until I actually close the windows form application window.
Nothing urgent, more curiosity than anything, but any direct would be appreciated. Thanks.