BeforeDoubleClick Event (2007 System)
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

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)

public event DocEvents_BeforeDoubleClickEventHandler BeforeDoubleClick

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

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.

private void WorksheetBeforeDoubleClick()
    this.BeforeDoubleClick += 
        new Excel.DocEvents_BeforeDoubleClickEventHandler(

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

© 2015 Microsoft