You know that pressing Ctrl+R in the VBE takes you to the Project Explorer. Of course you do. I’m not going to sit here and insult your intelligence by pretending that you don’t. But that means you are probably also just as confused as I am about which projects the VBE “chooses” to expand and which stay closed.
I have a lot of add-ins and that makes my Project Explorer very messy. Ideally I want the active project to be expanded and everything else collapsed. But I can’t have that. I decided I’ve had enough and added the following hotkey to my AutoHotKey VBE.ahk file.
^+r::
Send ^r
Send {End}
Loop 20 {
Send {Left 2}{Up}
}
When I’m in the VBE (an IfWinActive condition in VBE.ahk) and press Ctrl+Shift+R, the focus goes to the Project Explorer, goes to the last project, then closes up to 20 of them. Two left arrows will collapse an expanded project and has no effect on a collapsed project. The up arrow goes to the next project. Genius, you say? I humbly agree.
I don’t keep my modules in Folders (Toggle folders using the button at the top of the Project Explorer). If you do, you’ll need to change the {Left 2} to {Left 4}.
How many of the projects visible in the Explorer are from workbooks that you’ve closed?
Nigel, I’d say none. All the files in the pic except one are addins.
Dick, one interesting thing is that protecting the VBA project seems to ensure that it’s collapsed. Might even be the best reason to protect a project since the security is as weak as it is anyway. ;)
Right, none. I just have that many add-ins open all the time. None are very big, I just like my code to be nice and segmenty.
I used to protect my projects, but no more. Typing in the password (even Chip Pearson’s infamous ‘a’) was too much of a pain.
You should check MZTools :
http://www.mztools.com/v3/mztools3.aspx
There’s a specific command to collapse all open projects, and another one to close all open code windows.
It’s free, and I am not affiliated with them
Thanks Edouard. I didn’t know MZ Tools had that option. I could have used it like this
I am trying to decrease my reliance on MZ Tools so I can switch to 64-bit Office, so I’ll be sticking with AutoHotKey.