The Deactivate event fires when an Explorer or Inspector window ceases to be the active window, either as a result of user action or through program code. You should treat this event with caution! If you display user interface elements such as a message box in the Deactivate event procedure, Outlook might exhibit unpredictable behavior. The following procedure simply writes a string to the VBA Immediate window when the Deactivate event occurs:
Private Sub objExpl_Deactivate()
Debug.Print "Explorer Deactivate" End Sub
You should not display a message box, dialog box, or any other user interface element during the Deactivate event of an Explorer or Inspector object. Showing a user interface element in the Deactivate event may disrupt the activation sequence and make Outlook behave unpredictably.
Was this article helpful?