Scenario
I have a userform, and when a button is pressed, it opens an Excel file as read-only, gets some values, and closes that file. Following are the codes I am using to open and close the file.
To open: Set planbook = Workbooks.Open(planFilePath, ReadOnly:=True)
To close: planbook.Close False
Problem
After closing the file, I see that file in the project window, for each time I press the button.
It is using a lot of memory. Due to this, Excel hangs intermittently.
Why are files opened earlier but currently closed still appearing in the project window?
Note, when the button is pressed three times (means open and close a workbook three times), and thus there are three files listed in the picture.
Edit 1
It's not the module that remains, the whole file is visible in the VBA window, although the workbook is closed.
Edit 2
Noticed, if I keep the macro open for some time, the files showing in the project window, disappear one by one.
Edit 3
I found, the issue is due to opening and closing a shared workbook. See the answer for more explanation.