You are here:

Excel/VBA Project Window mystery


Using Excel 2007 VBA
Perhaps you can shed some light on something that strikes me as odd. I have a rather lengthy macro that opens several other excel files, copies data from each, then closes each, as the code runs along.
While I'm running tests, looking at the Project-VBAProject pane in the VBA window, I can watch each file name as it opens and then goes away after the code closes it. Fine and dandy.
The majority appear then disappear as expected. However, there are a couple of file names that remain in the pane well after they have been closed. The code tells them to go away just like the others.
I don't know if this is problem or not, maybe you can explain it.

ANSWER: If you use a statement like
Set x = Something (in the workbook being opened) and you don't say Set x = Nothing then that can happen. Or, if the opened workbooks run code like that, that can happen.
Is that the case?

---------- FOLLOW-UP ----------

QUESTION: There's no code in the opened workbooks. However, there are Set Statements in each portion of the code that deals with the opened workbooks. But only 3 of the dozen or so files do not disappear from the project pane like the others do.
The code works correctly, but I was concerned that maybe they were still "somewhat open" and taking up memory somehow. Not sure if I even need to be concerned about this.
Is Best Practice to "UnSet" after each of sub routines? If so, how do I do it?

If you've done something like
Set x = activeworkbook
then at the end of that sub use
Set x = Nothing.
And yes, it's good practice.
And no, you don't really need to concern yourself with the "phantom" workbooks showing in the VBE -- unlikely to cause a problem. And they disappear when you exit Excel anyway, of course.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2017 All rights reserved.