Show or hide warning messages by using Visual Basic

Show or hide warning messages by using Visual Basic

  1. Open a Function or Sub procedure in the Code window.

  2. In the place in the procedure where you want to stop or resume the display of modal warning messages, use the SetWarnings method to carry out the SetWarnings action.

    How?

  3. To temporarily stop the display of warning messages, set the warningson argument to False. To resume displaying them, set the warningson argument to True.

  4. Run the procedure.

    How?

When the code stops running, the display of warning messages automatically resumes.

For more information about the SetWarnings method, click .