BeforeMinimize Event

Microsoft Outlook Visual Basic

BeforeMinimize Event

       

Occurs when the active Explorer or Inspector is minimized by the user. This event can be cancelled after it has started.

Private Sub expression_BeforeMinimize(Cancel As Boolean)

expression   An expression that returns one of the object in the Applies To list declared with events in a class module.

Cancel   Required Boolean. False when the event occurs. If the event procedure sets this argument to True, the operation is not completed and the Explorer or Inspector is not minimized.

Example

The following example prompts the user with a message before the window is minimized. If the user clicks Yes, the Explorer is minimized.

Private Sub objExplorer_BeforeMinimize(Cancel As Boolean)
'Prompts the user before minimizing the Explorer

    Dim lngAns As Long

    lngAns = MsgBox("Are you sure you want to minimize the current window?", vbYesNo)
    If lngAns = vbYes Then
        Cancel = False
    Else
        Cancel = True
    End If
End Sub