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

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

语法Syntax

expression.expression. SheetBeforeRightClick( _Sh_ , _Target_ , _Cancel_ )

expression:一个返回 Workbook 对象的表达式。expression An expression that returns a Workbook object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
ShSh 必需Required ObjectObject 代表工作表的**Worksheet** 对象。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 如果发生事件,则为 FalseFalse 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.

注解Remarks

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

示例Example

本示例禁用默认右键单击操作。This example disables the default right-click action. 有关其他示例,请参阅BeforeRightClick事件示例。For another example, see the BeforeRightClickevent example.

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

另请参阅See also

Workbook 对象Workbook Object

支持和反馈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.