Code Explorer for better navigation and more

The Code Explorer (like the project explorer) is a dockable window that shows all objects in your project including their procedures, methods and properties. A double-click on a procedure moves you to it's position in the module giving you a fast way to find and move to the code you need to work on. In addition it allows you to insert selected procedure into the current position in the code, comment, select or remove procedures, drag procedures to other modules (move) or projects (copy) and more.

code explorer in action

Getting the Code Explorer window in place

When you use Code VBA the first time you have to dock the Code Explorer window. A good place to put it is on the left side of the code pane. Because Code Explorer supports all methods in the built-in Project Explorer (save as, remove,...) - and adds many others - you may as well close the Project Window.

Ctrl-Shift-E allows you to enter the Code Explorer window without using the mouse.

To open the Code Explorer dockable window:

Click this start demo open and dock Code Explorer to see how to open and dock the Code Explorer.code vba If demo

Other things you can do with the code explorer

Right-click (Ctrl-Shift-F10) the Code Explorer to get access to actions available on the selected item. Select the action using mouse or arrow or mnemonic key (first character of action name).

Code Explorer shortcut menu

Procedure item actions

  • Go To: Transer focus to selected procedure. The easiest and fastest way to navigate the code in your project. Same as double-click on a procedure as in the Gif at the top of this page.
  • Insert: insert this item as procedure call code into cursor position
  • Immediate: Try vba using Immediate Window
  • Select: select the code of a procedure, for example for copying
  • Comment: disable (comment) code by adding comment character ' to the beginning of the lines in the procedure
  • Rename: Rename procedure. You will be asked: 'Do you want to apply the new name to all its calls in the code?'. This way you don't have to manually find and replace the call in all the modules where it is used.
  • Delete: delete the selected procedure
  • Add Error Handling: Inserts code to handle run time errors from one of the available error handling strategies
  • Add Line Numbers: helps locate where an error occurred
  • Remove Line Numbers
  • Tidy Indentation: When applied from a module or procedure all code is correctly indented making it much more readable.
  • Print...: to the printer
  • Print as HTML: create html page for selected item

Module item actions

Code Explorer shortcut menu module
  • View Object: open the form in design mode
  • View Code: navigates to the selected items code (also double-click).
  • [Access Form/Excel Sheet] Properties: opens the properties pane for the selected object
  • Go To: Transer focus to selected procedure
  • Insert (project or module node): new module, class or userform
  • Select: select code of procedure, for example for copying
  • Import File...: adds module from file (project or module node)
  • Export File...: saves as file (module node)
  • Rename: Rename module.
  • Delete: delete the selected module
  • Tidy Indentation: When applied from a module or procedure all code is correctly indented making it much more readable.
  • Print...: to the printer
  • Print as HTML: create html page for selected item

Move procedures using drag and drop

In the Code Explorer you can move both procedures and modules using drag and drop.

  • Procedure drag and drop: move if in same project, copy if dragged to other project
  • Module drag and drop: copy if dragged to other project - else nothing.