BeforeSize Event

Microsoft Outlook Visual Basic

BeforeSize Event

       

Occurs when the user sizes the current Explorer or Inspector. This event can be cancelled after it has started. If the event is cancelled, the window is not sized.

Private Sub expression_BeforeSize(Cancel As Boolean)

expression   An expression that returns an 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 sized.

Example

The following example prompts the user with a warning message before the Inspector is sized. If the user clicks Yes, the Inspector can be sized.

Private Sub expression_BeforeSize(Cancel As Boolean)
'Prompts the user before resizing the window

    Dim lngAns As Long

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

End Sub