Share via


Workbook.SheetBeforeDoubleClick Event (2007 System)

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Event SheetBeforeDoubleClick As WorkbookEvents_SheetBeforeDoubleClickEventHandler
'Usage
Dim instance As Workbook 
Dim handler As WorkbookEvents_SheetBeforeDoubleClickEventHandler 

AddHandler instance.SheetBeforeDoubleClick, handler
public event WorkbookEvents_SheetBeforeDoubleClickEventHandler SheetBeforeDoubleClick
public:
 event WorkbookEvents_SheetBeforeDoubleClickEventHandler^ SheetBeforeDoubleClick {
    void add (WorkbookEvents_SheetBeforeDoubleClickEventHandler^ value);
    void remove (WorkbookEvents_SheetBeforeDoubleClickEventHandler^ value);
}
JScript does not support events.

Remarks

This event does not occur on chart sheets.

Examples

The following code example demonstrates a handler for the SheetBeforeDoubleClick event. The event handler informs the user that double-clicking is not allowed for the worksheet, and then sets the Cancel parameter of the WorkbookEvents_SheetBeforeDoubleClickEventHandler event handler to true so that Microsoft Office Excel cancels the double-click action.

This example is for a document-level customization.

Sub ThisWorkbook_SheetBeforeDoubleClick(ByVal Sh As Object, _
    ByVal Target As Excel.Range, ByRef Cancel As Boolean) _
    Handles Me.SheetBeforeDoubleClick

    MsgBox("Double-clicking in " & CType(Sh, Excel.Worksheet).Name & _
        " is not allowed.")
    Cancel = True 
End Sub
private void WorkbookSheetBeforeDoubleClick()
{
    this.SheetBeforeDoubleClick +=
        new Excel.WorkbookEvents_SheetBeforeDoubleClickEventHandler(
        ThisWorkbook_SheetBeforeDoubleClick);
}

void ThisWorkbook_SheetBeforeDoubleClick(object Sh,
    Excel.Range Target, ref bool Cancel)
{
    MessageBox.Show("Double-clicking in " + ((Excel.Worksheet)Sh).Name +
        " is not allowed.");
    Cancel = true;
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace