Workbook.SheetBeforeRightClick event (Excel)

Occurs when any worksheet is right-clicked, before the default right-click action.

Syntax

expression. SheetBeforeRightClick( _Sh_ , _Target_ , _Cancel_ )

expression An expression that returns a Workbook object.

Parameters

Name Required/Optional Data type Description
Sh Required Object A Worksheet object that represents the sheet.
Target Required Range The cell nearest to 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 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. 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 Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.