Fixing Docking Of Windows In The VBE
If you're a VBA programmer like me, you're probably picky about your window arrangements in the Visual Basic Editor. Sometimes it messes things up and it can be a challenge to get those windows where you want them.
First of all, you have to choose whether or not you want them to dock at all. Tools, options, Docking enables you to set that for each window separately:

Fig 1, Tools, Options, Docking tab for the VBE.
Suppose your window looks like this:

Fig 2, VBE window. Project explorer above Properties window.
and you want it to look like this:

Fig 3, VBE window. Project explorer below Properties window.
What do you do?
- Double click the title bar of the project explorer (it will become a floating window)
- Drag the center of the window back to the area where the Properties window is.
- Keep moving until the thickness of the window border changes to a thin line
- Now move downwards until you're almost at the bottom of the VBE window. The shape of the window should change.
- Let go.
Since a picture says more than a 1000 words and a movie is worth a 1000 pictures, I've recorded my movements while doing these things. Download the movies:
Docking the project explorer window
Sometimes, one of the windows disappears completely. This may be caused by a change in screen resolution, but I've heard of inexplicable disappearances too. To fix that, follow these steps:
- Open the VBE and select Tools, Options
- Select the Docking tab and make sure the window in question has no checkmark in that tab
- Close the options window and select Window, Cascade.
- Now open the Options dialog again and check the docking property of the window you just (hopefully) got back.
- Drag it to where you want it docked.




Comments
Showing last 8 comments of 35 in total (Show All Comments):Comment by: R L Jeffcoat (8/17/2011 10:52:38 AM)Thanks for a clear explanation of a useful but poorly documented feature. This is a very helpful site!
Comment by: Jan Karel Pieterse (8/22/2011 2:42:32 AM)Hi John,
I'm afraid I wouldn't know how Access handles this!
Comment by: mesh (9/2/2011 3:56:51 PM)how do you prevent the Microsoft Excel Objects menu opening up all the time? it's very annoying
Comment by: Jan Karel Pieterse (9/4/2011 11:01:01 PM)Hi Mesh,
Not sure what you are referring to. Do you mean the Object browser in the VBA editor?
Comment by: mesh (9/5/2011 2:53:50 AM)Thanks Jan,
not the object browser, the project explorer windows on the left hand side, the one with cascading folders:
+ VBAProject(filename.xlsm)
+ Microsoft Excel Objects
+ Sheet1
+ ...etc
+ Forms
+ Modules
+ Class Modules
the first menu opens whenever you browse away from the VBA Editor and so if you have more than a few sheets you have to scroll down all the time.
Comment by: Jan Karel Pieterse (9/5/2011 2:59:18 AM)Hi Mesh,
A workbook's VBA project opens in the state it was in when you saved the workbook. To ensure a workbook opens in collapsed state in the project explorer, you must close all code windows, then collaps the project and then save the file. Another way is to set a password on the VBProject.
Comment by: Paul (9/23/2011 9:57:08 AM)Big Thanks.
My VBA windows docking got screwed up and I just couldn't resolve it until I read your article!!!!
Comment by: Geoff Morris (10/25/2011 6:43:28 AM)Thanks.
Even following your instructions it took me a good ten minutes to force the damned things back into their proper docking positions! The project pane kept insisting on filling the window width or the project and properties panes would both become ten characters thick and stuck side-by-side etc. There's really something wrong with the way this "works"...
Anyway, I came here because I am one of those who had an inexplicable screw-up to start with... in my case, the main menu and toolbars simply disappeared! While trying to fix this I accidently closed the projects pane and then all hell broke loose... (The menu and toolbars came back when I closed and re-opened the editor.)
Have a question, comment or suggestion? Then please use this form.
If your question is not directly related to this web page, but rather a more general "How do I do this" Excel question, then I advise you to ask your question here: www.eileenslounge.com.