"Application.Quit" leaves Excel in the background

I have a small excel file that is launched by the scheduling application every 15 minutes.

Functions in excel cells read data from different places on the network and store them in cells in this excel file. Everything works perfectly.

The VBA code then saves the file and executes Application.Quit.

In a previous excel version, it worked great. Starting with the upgrade to 2016, Application.Quit closes the "excel interface", but the task manager shows a hundred "Excel.exe" that are still sitting there, using up to 40 MB of memory.

The attached image shows only five excel.exe in the task manager, since at the moment the computer is running less than two hours. But after 24 hours there are about 100 of them. Thus, the computer crashes in a few days.

Excel.exe still running


Thanks for the ambulance. I am not sure that I should give my answers here by editing my original question.

Here is the code. Actual cell values ​​are updated in the cells themselves. There is an Add In that reads values ​​from some PLCs in our factory. Everything works perfectly.

 Private Sub Workbook_Open() Application.CalculateFull ActiveWorkbook.Save Application.Quit End Sub 

When the excel file is launched, it is updated and closed. This worked for many years until we upgraded to 2016. Application.Quit will force excel to completely go away. Not now.

+6
source share
2 answers

Prior to Excel 2016 , Excel had the ability to have multiple Excel files in one window.

In Excel 2016, this is one window for each application.

The problem with your code is that it closes the instance. Based on how the Excel files were opened, this would be enough or not. For example, if Excel files were opened in the same instance, that would be enough.

+3
source

I am a little amateur, and I understand that this is a little old topic, but I wonder if you save the workbook (like you), but close it and exit Excel, it can clear the task manager. I noticed that you are saving the book, but you are not actually closing the book, so it remains open. I have encountered a similar problem before, and I think that this is finally what fixed it.

I use this code every time I want to exit Excel. Usually I have 2 books open, one of which is a template (which I do not save), and the other is created using data from the template.

 ActiveWorkbook.Close SaveChanges:=True Application.Quit ActiveWorkbook.Close SaveChanges:=False 
+2
source

Source: https://habr.com/ru/post/1276040/


All Articles