1

I am using Excel 2010.
When I close a workbook through the UI, or even through the workbooks(name_of_workbook).close method, the workbook remains in the VBA editor as a project.

Why is this? Is there a way to remove closed workbooks from the VBA editor?

JMax
  • 26,109
  • 12
  • 69
  • 88
Harry
  • 256
  • 1
  • 2
  • 13
  • Is your workbook an addin? Is it referred (using references) by any other open workbooks in VBA? – shahkalpesh Dec 22 '11 at 15:10
  • No, it's just a standard workbook. However, I have encountered a similar situation with workbooks that refer to another open workbook through VBA references. – Harry Dec 22 '11 at 15:32
  • Please check references of the other open workbooks. It could be a case where an existing open workbook (or addin) is referring to this workbook. – shahkalpesh Dec 22 '11 at 15:34
  • I am positive there are no references in these workbooks to other workbooks through VBA. – Harry Dec 22 '11 at 15:47
  • Similar thread... closing a workbook, then reopening the same workbook produces *2* listings in the VBA project listings; even though they are the same file. – Harry Dec 22 '11 at 15:52
  • I think I may have an answer. I have two VBA add-ins open as well, the Smart Indenter and VBA MZ-Tools. I tried opening and closing a workbook on a machine where these are not loaded (both add-ins require some registry tweaking to load properly on our machines) and I didn't encounter the issue. – Harry Dec 22 '11 at 16:00
  • @Harry post your comment as an answer and mark it as the answer, so others can benefit, even if you answered it yourself :) – JimmyPena Jan 05 '12 at 20:29

1 Answers1

1

I think I may have an answer. I have two VBA add-ins open as well, the Smart Indenter and VBA MZ-Tools. I tried opening and closing a workbook on a machine where these are not loaded (both add-ins require some registry tweaking to load properly on our machines) and I didn't encounter the issue.

Harry
  • 256
  • 1
  • 2
  • 13
  • See also my answer in: http://stackoverflow.com/questions/10696636/excel-vba-project-not-getting-closed/25744783#25744783 – jreichert Sep 09 '14 at 12:35
  • I have the exact same issue with pure VBA (not COM-Add-In, C#, VSTO, ...) in Excel365 (V2201 - 16.0.14827.20158, 64bit), but no add-ins are active. What can I try? – Traveler Feb 19 '22 at 13:41