Can't execute immediate statements in design mode

Design time is any time that your code isn't being executed, or is suspended and waiting to be continued. This error has the following cause and solution:

  • You tried to execute a statement in the Immediate window, but your code isn't in a running mode. Start your code running, and then suspend program execution. You can then execute code in the Immediate window.

For additional information, place the cursor in the Immediate window and press F1 (in Windows) or HELP (on the Macintosh).

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.