应用于 Worksheet 对象的 Activate 方法。
当双击某工作表时产生此事件,此事件先于默认的双击操作。
Private Sub expression_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
expression 引用在类模块中带有事件声明的 Worksheet 类型对象的变量。
Target 必需。双击发生时最靠近鼠标指针的单元格。
Cancel 可选。当事件发生时为 False。如果事件过程将该参数设为 True,则该过程执行完之后将不进行默认的双击操作。
当双击一张嵌入图表时产生此事件,并且此事件先于默认的双击操作。
Private Sub expression_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long, Cancel As Boolean)
expression 引用在类模块中带有事件声明的 Chart 类型对象的变量。
Cancel 可选。当事件发生时为 False。如果事件过程将该参数设为 True,则该过程执行完之后将不进行默认的双击操作。
ElementID 必需。双击的对象。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 | 无 |
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 | 指定某个系列中一个特定点在 Points 集合中的偏移量。-1 表示选定所有数据点。 |
SeriesIndex | 指定特定系列在 Series 集合中的偏移量。 |
ShapeIndex | 指定特定图形在 Shapes 集合中的偏移量。 |
TrendlineIndex | 指定某个系列中特定趋势线在 Trendlines 集合中的偏移量。 |
使用 DoubleClick 方法并不触发本事件。
用户双击单元格的边框时不触发本事件。
本示例将忽略图表基底的默认双击操作。
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