Share via


WindowBeforeRightClick Event

Occurs when you right-click a shape, a slide, a notes page, or some text. This event is triggered by the MouseUp event.

Private Subapplication**_WindowBeforeRightClick(ByValSelAs Selection**, ByValCancelAs Boolean)

*application    * An object of type Application declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object .

*Sel    * The selection below the mouse pointer when the right-click occurred.

*Cancel    *False when the event occurs. If the event procedure sets this argument to True, the default context menu does not appear when the procedure is finished.

Example

This example creates a duplicate of the selected shape. If the shape has a text frame, it adds the text "Duplicate Shape" to the new shape. Setting the Cancel argument to True then prevents the default context menu from appearing.

Private Sub App_WindowBeforeRightClick _         (ByVal Sel As Selection, ByVal Cancel As Boolean)
    With ActivePresentation.Selection.ShapeRange
        If .HasTextFrame Then
            .Duplicate.TextFrame.TextRange.Text = "Duplicate Shape"
        Else
            .Duplicate
        End If
        Cancel = True
    End With
End Sub

Applies to | Application Object

See Also | WindowBeforeDoubleClick Event