Excel) (Chart.BeforeDoubleClick 事件

在預設的按兩下動作之前,按兩下圖表元素時,即發生此事件。

語法

運算式。BeforeDoubleClick (ElementID, arg1, arg2, 取消)

expression 代表 Chart 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Cancel 必要 布林值 False 事件發生時。 如果事件程序會將此引數設定為 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 無 無
xl無 無 無
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 指定特定欄 (數列) 、資料、頁面或列 (類別) 欄位的樞 紐分析欄位 集合位移。
PointIndex 指定數列中特定點的 Points 集合內的位移。 值 1 表示已選取所有資料點。
SeriesIndex 指定特定數列在 Series 集合內的位移。
ShapeIndex 指定特定圖案在 Shapes 集合內的位移。
TrendlineIndex 指定數列中特定趨勢線在 Trendlines 集合內的位移。

範例

這個範例會使圖表底板的預設按兩下行為無效。

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 支援與意見反應。