BeforeMaximize Event
Occurs when an Explorer or Inspector is maximized by the user. This event can be cancelled after it has started.
Private Sub expression_BeforeMaximize(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 maximized.
Example
The following example prompts the user with a warning message before maximizing the current window. If the user clicks Yes, the explorer will maximize.
Private Sub objExplorer_BeforeMaximize(Cancel As Boolean)
'Prompts the user before maximizing the explorer
Dim lngAns As Long
lngAns = MsgBox("Are you sure you want to maximize the current window?", vbYesNo)
If lngAns = vbYes Then
Cancel = False
Else
Cancel = True
End If
End Sub