Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closed files still appearing in Project Explorer Window

Status
Not open for further replies.

rguglielmon

Technical User
Jan 6, 2003
12
US
I have a macro that opens and closes a number of workbook files. The problem is that the files remain in my Project Explorer window even after closing Excel and rebooting. I've done similar things before and never had this happen.
Here's the code I use to open the files:
Set RegionBook = Workbooks.Open(RegionFilePath & RegionFileNames(i))

and the code to close them:

RegionBook.Close

2 questions:
1) What can I do to prevent these files from remaining in the Project Explorer window?
2) How do I get rid of the ones that are there?
 
Hi rguglielmon,

Add ..

Code:
[blue]Set RegionBook = Nothing[/blue]

.. after the Close. That should destroy the workbook object.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Tony,

Thanks for the reply! I added this code and still had the files added to the Project Explorer Window. I now have about 3 dozen unopened files in the window and its getting unmanageable.

Any other ideas?

Bob
 
Hi Bob,

What directory are these workbooks in?

It's not a startup file location is it?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
just something from left field here but you havn't just got the latest ASAP utilities upgrade have you ??

Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
No. At least I don't think so. I'm not sure what the ASAP utilities are.
 
Check if you open the file as an addin or a reference.
go to excel-tool-addin to check addin.
go to vb editor-tool-reference to check reference.

tianjin
 
which one ?

Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
hmmm - maybe a generic problem with xlas then - I have a similar issue but it has only just started occuring after I installed the latest update to an add-in I use (ASAP Utilities)

Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
The variable Regionbook is a private or a public in your code?[Set RegionBook = Workbooks.Open(RegionFilePath & RegionFileNames(i))]. if it is a public variable and referenced by other segment of code in your progame, it might cause this problem because a public variable will be alive as long as excel runing. However, that you said even you closed Excel or reboot your machine and those workbooks still show in the project explorer is really strange. Here, I want to clarify some points:
1. this happened before or after you run your code.
2. Disable any open and run marco and start Excel from start_All progam, then Alt_F11. what you see in project explorer. Is there just one vbproject or a lots.

Tianjin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top