SheetBeforeRightClick 事件 (Excel)Workbook.SheetBeforeRightClick event (Excel)

右键单击任一工作表时发生此事件,此事件先于默认的右键单击操作。Occurs when any worksheet is right-clicked, before the default right-click action.


表达式SheetBeforeRightClick(Sh, Target, Cancel)expression.SheetBeforeRightClick (Sh, Target, Cancel)

_表达式_一个返回**工作簿** 对象的表达式。expression An expression that returns a Workbook object.


名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
ShSh 必需Required ObjectObject 一个代表工作表的**工作表** 对象。A Worksheet object that represents the sheet.
TargetTarget 必需Required RangeRange 右键单击发生时最靠近鼠标指针的单元格。The cell nearest to the mouse pointer when the right-click occurred.
CancelCancel 必需Required BooleanBoolean False 在事件发生时。False when the event occurs. 如果事件过程将此参数设为 True,则在完成此过程后,不执行默认的右键单击操作。If the event procedure sets this argument to True, the default right-click action isn't performed when the procedure is finished.


图表工作表中不发生此事件。This event doesn't occur on chart sheets.


本示例禁用默认的右键单击操作。This example disables the default right-click action.

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, _ 
 ByVal Target As Range, ByVal Cancel As Boolean) 
 Cancel = True 
End Sub

有关另一个示例, 请参阅**BeforeRightClick** 事件示例。For another example, see the BeforeRightClick event example.

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.