Excel) (Chart.BeforeDoubleClick 事件

当双击某图表元素时发生此事件,此事件先于默认的双击操作。

语法

表达式。BeforeDoubleClick (ElementID, arg1, arg2, 取消)

expression:一个表示 Chart 对象的变量。

参数

名称 必需/可选 数据类型 说明
Cancel 必需 Boolean 假 的事件发生时。 如果事件过程将此参数设置为 True ,默认的双击操作在完成此过程后,不执行。
Arg1 必需 Long 其他事件信息,取决于 ElementID 的值。 有关此参数的详细信息,请参阅“说明”部分。
Arg2 必需 Long 其他事件信息,取决于 ElementID 的值。 有关此参数的详细信息,请参阅“说明”部分。
ElementID 必需 Long 双击的对象。 此参数的值确定 Arg1 和 Arg2 的期望值。 有关此参数的详细信息,请参阅“说明”部分。

备注

DoubleClick 方法不会导致此事件发生。

用户双击单元格的边框时不触发此事件。

Arg1 和 Arg2 的含义取决于 ElementID 值,如下表中所示。

ElementID Arg1 Arg2
xlAxis AxisIndex AxisType
xlAxisTitle AxisIndex AxisType
xlDisplayUnitLabel AxisIndex AxisType
xlMajorGridlines AxisIndex AxisType
xlMinorGridlines AxisIndex AxisType
xlPivotChartDropZone DropZoneType 无
xlPivotChartFieldButton DropZoneType PivotFieldIndex
xlDownBars GroupIndex 无
xlDropLines GroupIndex None
xlHiLoLines GroupIndex 无
xlRadarAxisLabels GroupIndex 无
xlSeriesLines GroupIndex 无
xlUpBars GroupIndex 无
xlChartArea 无 无
xlChartTitle 无 无
xlCorners 无 无
xlDataTable 无 无
xlFloor 无 无
xlLegend 无 无
xlNothing 无 无
xlPlotArea 无 无
xlWalls 无 无
xlDataLabel SeriesIndex PointIndex
xlErrorBars SeriesIndex 无
xlLegendEntry SeriesIndex 无
xlLegendKey SeriesIndex 无
xlSeries SeriesIndex PointIndex
xlTrendline SeriesIndex TrendLineIndex
xlXErrorBars SeriesIndex 无
xlYErrorBars SeriesIndex 无
xlShape ShapeIndex 无

下表对参数含义进行说明。

参数 说明
AxisIndex 指定轴主要或辅助。 可以是下列的 XlAxisGroup 常量之一: xlPrimary 或 xlSecondary 。
AxisType 指定坐标轴类型。 可以是下列的 XlAxisType 常量之一: xlCategory 、 xlSeriesAxis 或 xlValue 。
DropZoneType 指定拖放区域类型: 列、 数据、 页或行字段。 可以是下列的 XlPivotFieldOrientation 常量之一: xlColumnField 、 xlDataField 、 xlPageField 或 xlRowField 。 列和行字段常量分别指定系列和分类字段。
GroupIndex 指定特定图表组的 ChartGroups 集合中的偏移量。
PivotFieldIndex 指定 PivotFields 集合中特定列 (系列) 、数据、页或行 (类别) 字段的偏移量。
PointIndex 指定系列中的特定点的 点 集合中的偏移量。 值 1 表示已选中所有数据点。
SeriesIndex 指定一系列特定的 系列 集合中的偏移量。
ShapeIndex 指定某一特定形状的 Shapes 集合中的偏移量。
TrendlineIndex 指定 趋势线 集合在一系列内的特定趋势线中的偏移量。

示例

此示例将重写图表基底的默认双击操作。

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

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。