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_ )

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

参数Parameters

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

注解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