类 "Chart类" 中写以下代码,其实,有第一句就够了,其它的都是它的事件进行的事项 Private Sub Chart事件_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long) 需要用到这个类的工作表中写以下代码 Dim 新Chart类 As New Chart类 Sub 结束事件连接() 到此以经可以正常运行了,因为有时候要关联许多表,就要用到下面语句 Dim 新Chart类 As New Chart类 Dim 新Chart类s() As New Chart类 Private Sub xxxxxWorksheet_Activate() '如有必要 '为表中的每一个图表建立秩序 If ActiveSheet.ChartObjects.Count > 0 Then ReDim 新Chart类s(ActiveSheet.ChartObjects.Count) For Each chtObj In ActiveSheet.ChartObjects i = i + 1 Set 新Chart类s(i).Chart事件 = chtObj.Chart Next End If End Sub Sub xxxxx结束事件连接() '如有必要 '为表中的每一个图表断开连接 Dim i As Integer On Error Resume Next Set clsEventChart.EvtChart = Nothing For i = 1 To UBound(clsEventCharts) Set clsEventCharts(i).EvtChart = Nothing Next End Sub |
|