top of page

Code Explorer

  • Writer: John
    John
  • 3 days ago
  • 3 min read

VBE_Extras now has a Code Explorer dialog which allows you to explore the entire code base loaded into the VBE. When the dialog is first opened, the "tree" of declarations will be expanded to the declaration that is selected / the cursor is positioned within (the path to this declaration will be shown in bold). From this point, you can expand or collapse all declarations within all VBA Projects (so long as they are unlocked) loaded in the VBE.

 

The code explorer dialog

The scope of declarations shown by the Code Explorer dialog can be controlled in the Options, however, by default it includes all declarations of all types that are supported in the VBA language (see the post VBE_Extras catch-up #2: Listing all declarations for a full list of declaration types).

 

Having selected a declaration in the tree of declarations, you can (not all options are available for all types of declaration):

  • Using the right-click context menu or using the buttons in the dialog itself:

    • Goto it i.e. display it in the code pane

    • Display all references of it

  • Using the right-click context menu only:

    • Copy its name

    • Copy the entire declaration as text

    • View the declaration

    • Rename the declaration

    • For Project References to Type Libraries, "explore" the members of the Type Library (see the post Type Library explorer for more info)


Options

 

The Code Explorer dialog has an Options button which allows you to control:

  • Whether Modules, Project References and Conditional Compilation Arguments are shown in groups, or not

  • Whether the type of declaration comes before or after its name and whether the value type of the declaration (if it has a value type) is shown

  • Whether Project References and CCAs are shown

  • Whether declarations are sorted in the order they are declared in or in alphabetical order

  • The scope of the declarations shown … can be:

    • Just Projects and Project members (that is, Modules and, if shown Project References and CCAs)

    • Projects, Project members, procedures and properties

    • Projects, Project members and all Module-level members

    • All declarations

  • The text colours used in the tree of declarations … by default, the text is black. You can change this to use different colours either by declaration "level" (as in the screenshot, above) or by type

 

As with other VBE_Extras dialogs that show lists or trees of items, visible stripes can be shown (or switched off) via the "Stripy rows" option in the UI tab of the Settings dialog, and the font size can be controlled via the "Font size" option in the same tab.

 

Whether compiled-out (i.e. due to conditional compilation) declarations are shown or not is controlled by the "Match conditional compilation directives" option in the Other tab of the Settings dialog.

 

Attributes / Interfaces

 

Class Modules that are Interfaces are distinguished using a separate icon from the normal Class Module icon.

 

If "Indicate VB_PredecaredId" is checked in the UI tab of the Settings dialog, then the names of Class Modules that have the VB_PredeclaredId attribute set to True will be followed by "PdI".

 

If "Indicate VB_Exposed and VB_Creatable" is checked in the UI tab of the Settings dialog then the names of Class and UserForm Modules that have the VB_Exposed attribute set to True will be followed by "Exp" and the names of Class Modules that have the VB_Creatable attribute set to True will be followed by "Crt".

 

Option Explicit

 

If a Project has one or more Modules without Option Explicit, the Tooltip for the Project will say how many. And if a specific Module does not have Option Explicit, the Tooltip for the Module will say so.



Comments


bottom of page