top of page

VBE_Extras catch-up #1: The Module-picker (and the Project Picker)

  • Writer: John
    John
  • 3 days ago
  • 3 min read
When I first made VBE_Extras available for download, it contained a whole load of functionality that I never wrote blog posts about. I'm now setting that right for a few of the core areas of that functionality.

In additional to VBA code, I also develop with C# code. For the VBA code, I develop in the VBE. For the C# code, I develop in Visual Studio. Much of the inspiration for functionality in VBE_Extras comes from the functionality that is available in Visual Studio but not available in the VBE. One such example is the Module-picker (it's not called that in Visual Studio ... but the principle is the same).


The Module-picker is a quick, keyboard-centric way of navigating between Modules in a VBA Project, so it's of most benefit to people (like me) that prefer using the keyboard to navigate around a Project rather than using the mouse. It replaces the built-in behaviour of the VBE that acts in a similar, though less user-friendly (I believe!), manner.


The Module Picker shows a dialog listing the Modules (document, standard, Class and UserForm) of the active Project in the order they were last accessed, or alphabetically for those never accessed. As well as being useful to navigate between Modules generally, it's very handy for going back-and-forth between two Modules ... the currently shown Module and the last-shown Module. I find often, when developing code, that I need to refer to code in another specific Module and the Module Picker is really useful for that purpose.


Also, UserForm 'designers' (highlighted in the Module Picker dialog) are treated as though they are separate Modules so that you can easily navigate between the UserForm code and the UserForm designer in the same way, as noted above, for the currently shown and the last-shown Module.


The default keyboard shortcut for the Module Picker is Ctrl+Tab. A single press-and-release of the keyboard shortcut will show the last-shown Module. Pressing the keyboard shortcut again will repeat that so that you are flicking between the two last shown Modules.


However, if you press the keyboard shortcut and then continue to hold down the Ctrl key (having released the Tab key), the Module Picker dialog will remain on screen (and will continue to do so for as long as you hold down the Ctrl key). Any subsequent press of the Tab key will cycle the selection through all of the other Modules in the Project. You can also use the up / down arrow keys to cycle between Modules (the down arrow key is the same as pressing the Tab key; the up arrow key cycles in the reverse order). When you release the Ctrl key, the selected Module will be activated and shown.


The Module Picker

To use the Module Picker, as opposed to the build-in Ctrl+Tab behaviour, the "Module and Project Pickers are enabled" check box in the "Shortcut Keys" tab of the Settings must be checked.


And while I'm mentioning it, there is also a Project Picker which operates similarly to the Module Picker but for Projects. The default keyboard shortcut is Ctrl+1 (in the number row, not in the number pad). The Project Picker and the Module Picker will work together in that if the Module Picker is being shown and you press the left arrow key then the Project Picker will be displayed; if the Project Picker is being shown and you press the right arrow key then the Module Picker will be displayed (showing the Modules of the Project that was active in the Project Picker at the point that you pressed the right arrow key!).


As well as the Module and Project Pickers, VBE_Extras provides a number of ways to help you navigate your code. You might also be interested in:







Comments


bottom of page