WindowBeforeRightClick Event 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