Worksheet.BeforeDoubleClick Event (2007 System)

Occurs when the 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 BeforeDoubleClick As DocEvents_BeforeDoubleClickEventHandler
'Usage
Dim instance As Worksheet 
Dim handler As DocEvents_BeforeDoubleClickEventHandler 

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

Remarks

This event does not occur when the user double-clicks the border of a cell.

Examples

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

This example is for a document-level customization.

Sub Worksheet1_BeforeDoubleClick(ByVal Target As Excel.Range, _
    ByRef Cancel As Boolean) Handles Me.BeforeDoubleClick
    MsgBox("Double-clicking in this sheet is not allowed.")
    Cancel = True 
End Sub
private void WorksheetBeforeDoubleClick()
{
    this.BeforeDoubleClick += 
        new Excel.DocEvents_BeforeDoubleClickEventHandler(
        Worksheet1_BeforeDoubleClick);
}

void Worksheet1_BeforeDoubleClick(Excel.Range Target, 
    ref bool Cancel)
{
    MessageBox.Show("Double-clicking in this sheet" +
        " is not allowed.");
    Cancel = true;
}

.NET Framework Security

See Also

Reference

Worksheet Class

Worksheet Members

Microsoft.Office.Tools.Excel Namespace