How to programatically delete/remove a vbproject from project explorer

uk_nod

New Member
Joined
Jan 2, 2005
Messages
2
Thanks for reading this post.

I am programmatically looping through N workbooks (open workbook, process, close workbook). When I close the workbook, I am left with a "footprint" of workbook in project explorer, even though the workbook itself is closed.

This is causing problems as well as slowing down the processing of the current workbook, the further into the series I am.

Any ideas? Or ways to delete/remove the VBProject?

Many thanks for your responses

UK Nod

Here's a code sample of what I'm doing
=============================
strFileName = Dir(strPath & "\" & strMask) ' get a wbk from disk that matches mask

Do While strFileName <> ""
lngLoopCounter = lngLoopCounter + 1

Workbooks.Open strPath & "\" & strFileName
Application.StatusBar = strFileName
'
' do some stuff
'
Application.StatusBar = False
Workbooks(strFileName).Close saveChanges:=True ' Save results
strFileName = Dir

Loop
 

Some videos you may like

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,264
Hi, nod.

It is'nt clear what you are doing so I might be off target. I'm wondering if you need to open the files at all. For example files set up with well structured data don't need opening to read or write data.

regards, Fazza
 

uk_nod

New Member
Joined
Jan 2, 2005
Messages
2
Hi Fazza

The workbooks contain data. Separately I have an xla that processes that data and creates an analysis, which is saved with the data.

Each workbook has different data, but the processing is identical.

The problem I've desecribed in my original post is something I've seen before and lived with. Typically, I might open several workbooks manually, do something between them, and then close say 2 or 3 of them. The closed ones "remain" in project explorer. The only way I've managed to get rid of them before is to close Excel. That can't be right!

Thanks

Nod
 

Watch MrExcel Video

Forum statistics

Threads
1,090,109
Messages
5,412,473
Members
403,428
Latest member
ldmcd

This Week's Hot Topics

Top