Visual Basic for Applications Reference

Must close or hide topmost modal form first (Error 402)

Specifics

The modal form you are trying to close or hide isn't on top of the z-order. This error has the following cause and solution:

  • Another modal form is higher in the z-order than the modal form you tried to close or hide.

    First use either the Unload statement or the Hide method on any modal form higher in the z-order. A modal form is a form displayed by the Show method, with the style argument set to 1 vbModal.