The VBE code window elements


This module provides a brief description of items used in a VBA code module. The points described below are elements from figure 1.



Fig 1: xlfAnimatedVBA - the blinking insertion point shown here in over-type mode, plus other elements of a VBA code module

Code writing

  1. VBA Key word - Foreground: Color 5 [Blue], example: Option Explicit, Sub, Call,...
  2. Comment text (item 3) - Color 10, example: ' [Break] at Stop

Blinking insertion point

  1. Blinking insertion point (BIP) (item 2) - over-write mode , and insert mode |. Press Insert on the keyboard to switch between modes

    The position of the BIP is shown by the line and column indicators on the VBE Standard Toolbar. Currently positioned at Line 5 Column 8 [Ln 5, Col 8] in figure 1. Note the use of row, column coordinates

    Position the BIP in a Sub procedure to execute code with F5 or Run Sub

    Move the BIP with the keyboard Arrow keys or Click a location with the Mouse.

Margin indicator bar

Items D to F have indicators in the Margin Indicator Bar / gutter. If the Margin Indicator Bar is not visible, change the settings on the Tools > Options ... > Editor Format > Margin Indicator Bar)

  1. Call return (item 1,) - [for advanced use only] Margin Indicator: Color 4 - activate from the View > Call Stack... in [Break] mode
  2. Execution point (item 4) - Margin Indicator: arrow Color 6 [Yellow], Background: Color 6 [Yellow], example Stop. The execution point is the next code statement to be executed. Click F5 (Run) of F8 (Step) to continue
    Click Reset on the Standard Toolbar to clear the Execution point marker
  3. Break point (item 5) - Margin Indicator: Color 9, example: End Sub