Export (0) Print
Expand All

Use the Immediate Window

This page is specific to the Visual Basic for Applications (VBA) Language Reference for Office 2010.

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.

    NoteNote

    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.

Show:
© 2014 Microsoft