2.3.2 Mode / State
At any point in time, a VBA host environment is in exactly one of the following modes / states:
| Mode | Description |
|---|---|
Design |
A static context exists and is actively being synchronized with the workspace source code being edited. In design mode, the host environment maintains a static execution context (RD-VBAL §4.0 Program Structure and Organization). |
Run |
The host environment is actively executing instructions uninterrupted. |
Break |
Execution is halted at the current instruction. Instructions can be manually stepped over / into, or rewound (RD-VBAL §2.3.1.1 Execution Session). |
For an RD-VBA project without any modules, the host cannot exit design mode to run or debug (RD-VBAL §4.0 Program Structure and Organization).
Entering break mode
Break mode is entered through any of the following:
| Cause | Example |
|---|---|
| A manual break | Suspending running execution (Manual break, below). |
| A semantic break | A failed Assert call (RD-VBAL §5.4.2.23 Assert Statement), or an encountered Stop keyword (RD-VBAL §5.4.2.11 Stop Statement). |
| An unhandled run-time error | See Behaviour on error, below, and RD-VBAL §5.4.4 Error Handling Statements. |
Manual break
Provided that the host application is able to respond to keyboard inputs, execution in running mode may be suspended at any point to enter break mode.
In the Microsoft Visual Basic Editor, a manual break is entered with the Ctrl+Pause|Break keyboard shortcut. The platform considers this keyboard shortcut an implementation detail of the environment host.
An environment host may offer the same functionality through different, implementation-defined means that may or may not be equivalent.
Behaviour on error
👉 The exact behaviour of the host environment on error is implementation-defined.
Depending on the workspace application configuration, a failing workspace application may either:
- terminate the host process with an error code; or
- enter break mode and offer to debug at the failing location.
⏮️ RD-VBAL §2.3.1.3 Name Resolution | ⏭️ RD-VBAL §2.4 Static Types