Use the Immediate Window

Use the Immediate Window

Office 2013 and later

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

  1. Type a line of code in the Immediate window.

  2. 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.

    Note Note

    Immediate window statements are executed in a context — that is, as if they are entered in a specific module.

If you need help on syntax for functions, statements, properties, or methods while working in the Immediate window, select the keyword, the property name, or the method name, and press F1.

© 2016 Microsoft