当用鼠标右键单击某个形状、幻灯片、备注页或文本时发生此事件。此事件由 MouseUp 事件触发。
Private Sub application_WindowBeforeRightClick(ByVal Sel As Selection, ByVal Cancel As Boolean)
application Application 类型的对象,在类模块中声明,自身具有事件。有关使用 Application 对象的事件的详细信息,请参阅使用 Application 对象的事件。
Sel 鼠标右键单击时于鼠标指针以下的选定区域。
Cancel 当此事件发生时,为 False。如果事件过程将此参数设置为 True,则完成此过程后不会出现默认的快捷菜单。
本示例创建选定形状的一个副本。如果该形状有文本框,则将文本“Duplicate Shape”添加到新形状中。将 Cancel 参数设置为 True 可以避免出现快捷菜单。
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