Explorer.BeforeSize Event (Outlook)

Occurs when the user sizes the current Explorer.

expression .BeforeSize(Cancel)

expression A variable that represents an Explorer object.

Parameters

Name

Required/Optional

Data Type

Description

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 is not sized.

This event can be cancelled after it has started. If the event is cancelled, the window is not sized.

The following Microsoft Visual Basic for Applications (VBA) example prompts the user with a warning message before the Inspector is sized. If the user clicks Yes, the inspector can be sized. The sample code must be placed in a class module such as ThisOutlookSession, and the Initialize_Handler() subroutine should be called before the event procedure can be called by Microsoft Outlook.

Public WithEvents myIns As Outlook.Inspector 
 
 
 
Public Sub Initalize_Handler() 
 
 Set myIns = Application.ActiveInspector 
 
End Sub 
 
 
 
Private Sub myIns_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? Use your keyboard to make your selection.", vbYesNo) 
 
 If lngAns = vbYes Then 
 
 Cancel = False 
 
 Else 
 
 Cancel = True 
 
 End If 
 
End Sub
Show:
© 2014 Microsoft