This documentation is archived and is not being maintained.

Workbook.SheetBeforeRightClick Event

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


expression.SheetBeforeRightClick(Sh, Target, Cancel)

expression   An expression that returns a Workbook object.


NameRequired/OptionalData TypeDescription
ShRequiredObjectA Worksheet object that represents the sheet.
TargetRequiredRangeThe cell nearest to the mouse pointer when the right-click occurred.
CancelRequiredBooleanFalse 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.


This event doesn't occur on chart sheets.


This example disables the default right-click action. For another example, see the BeforeRightClick event example.

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