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!

too many code windows in VBE 1

Status
Not open for further replies.

RobBroekhuis

Technical User
Oct 15, 2001
1,971
US
Hi all,
I'm hoping someone has a solution for a common annoyance in VBE. I use Excel in a corporate environment with a number of predefined addins that load with Excel. Often (always?)when I first enter VBE, some of the code windows associated with these addins automatically open, so that I have more than ten code windows open. This makes tabbing through the ones I am actually working on cumbersome, so I have to first go and close all the other ones. VBE doesn't seem to have a "close all windows" menu command. Is there
a) a way of preventing the code windows from opening in the first place, or
b) a quick way to close them all?

I don't quite know why they are opening automatically - my own addins don't do this.
Rob
[flowerface]
 
I came up with a workable solution, by putting the following code in the workbook_open of my personal.xls:

Dim i As Integer
For i = Application.VBE.CodePanes.Count To 1 Step -1
Application.VBE.CodePanes(i).Window.Close
Next i

Still, I'm interested in your thoughts as to why the code panes are opening automatically...
Rob
[flowerface]
 
Rob,

I've found that if a workbook is saved / xla is created while the vba code windows are open they'll be opened automatically the next time you open the worksheet.

Solution: always be neat ;-) (hey I sound just like mom) & close all windows (I also collapse the Objects/Modules/ClassModules folders) & resave / recreate the addin

Cheers
Nikki
 
Yes, I was afraid of that. Unfortunately, some of the addins I do not have direct access to. Still, I will apply your logic to my own VBA dealings.
Thanks
Rob
[flowerface]
 
I have noticed the same thing. Have you tried using the 'Project Explorer' window (View- Project Explorer). I place it on the lefthand side of the VBE application as narrow as I can view the files. Then when I open up VBE I just maximize the top code window & move from module to module by double-clicking on the desired module in the 'Project Explorer' window. Crude but it saves 'Tabbing' through the code windows.
 
Those windows are really very annoying. I just protect project with a simple, one letter pasword, just to prevent opening unnecessary project windows.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top