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
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
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,129,271
Messages
5,635,215
Members
416,847
Latest member
inaramos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top