title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
Application.WindowBeforeRightClick event (PowerPoint) |
vbapp10.chm621002 |
|
|
e6239915-f487-3619-c84f-d436d645e6c0 |
06/08/2017 |
medium |
Occurs when you right-click a shape, a slide, a notes page, or some text. This event is triggered by the MouseUp event.
expression. WindowBeforeRightClick
( _Sel_
, _Cancel_
)
expression A variable that represents an Application object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Sel | Required | Selection | The selection below the mouse pointer when the right-click occurred. |
Cancel | Required | Boolean | 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. |
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, 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
[!includeSupport and feedback]