BeforeDoubleClick Event

Applies To

Chart object, Worksheet object.

Description

Occurs when an embedded chart or worksheet is double-clicked, before the default double-click action.

Syntax 1

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Syntax 2

Private Sub object_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)

object An object of type Chart declared with events in a class module.

Target The cell nearest to the mouse pointer when the double-click occurs.

Cancel False when the event occurs. If the event procedure sets this argument to True, the default double-click action isn't performed when the procedure is finished.

ElementID The double-clicked object. The meaning of Arg1 and Arg2 depends on the ElementID value, as shown in the following table.

ElementID

Arg1

Arg2

xlChartArea

None

None

xlChartTitle

None

None

xlPlotArea

None

None

xlLegend

None

None

xlFloor

None

None

xlWalls

None

None

xlCorners

None

None

xlDataTable

None

None

xlSeries

SeriesIndex

PointIndex

xlDataLabel

SeriesIndex

PointIndex

xlTrendline

SeriesIndex

TrendLineIndex

xlErrorBars

SeriesIndex

None

xlXErrorBars

SeriesIndex

None

xlYErrorBars

SeriesIndex

None

xlLegendEntry

SeriesIndex

None

xlLegendKey

SeriesIndex

None

xlAxis

AxisIndex

AxisType

xlMajorGridlines

AxisIndex

AxisType

xlMinorGridlines

AxisIndex

AxisType

xlAxisTitle

AxisIndex

AxisType

xlUpBars

GroupIndex

None

xlDownBars

GroupIndex

None


(continued)

ElementID

Arg1

Arg2

xlSeriesLines

GroupIndex

None

xlHiLoLines

GroupIndex

None

xlDropLines

GroupIndex

None

xlRadarAxisLabels

GroupIndex

None

xlShape

ShapeIndex

None

xlNothing

None

None


The following table describes the meaning of the arguments.

Argument

Description

SeriesIndex

Specifies the offset within the Series collection for a specific series.

PointIndex

Specifies the offset within the Points collection for a specific point within a series. The value – 1 indicates that all data points are selected.

TrendlineIndex

Specifies the offset within the Trendlines collection for a specific trendline within a series.

AxisIndex

Specifies whether the axis is primary (0) or secondary (1).

AxisType

Specifies the axis type: category (0), value (1), or series (2).

GroupIndex

Specifies the offset within the ChartGroups collection for a specific chart group.

ShapeIndex

Specifies the offset within the Shapes collection for a specific shape.


Remarks

The DoubleClick method doesn't cause this event to occur.

This event doesn't occur when the user double-clicks the border of a cell.

See Also

BeforeRightClick event, SheetBeforeDoubleClick event, SheetBeforeRightClick event.

Example

This example overrides the default double-click behavior for the chart floor.

Private Sub Chart_BeforeDoubleClick(ByVal ElementID As Long, _
        ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
    If ElementID = xlFloor Then
        Cancel = True
        MsgBox "Chart formatting for this item is restricted."
    End If
End Sub