Use the Immediate window
The Immediate window displays information resulting from debugging statements in your code or from commands typed directly into the window.
To display the Immediate window
- From the View menu, choose Immediate window (CTRL+G).
To execute code in the Immediate window
Type a line of code in the Immediate window.
Press ENTER to execute the statement.
Use the Immediate window to:
Test problematic or newly written code.
Query or change the value of a variable while running an application. While execution is halted, assign the variable a new value as you would in code.
Query or change a property value while running an application.
Call procedures as you would in code.
View debugging output while the program is running.
Immediate window statements are executed in a context—that is, as if they are entered in a specific module.
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.