Gruppe
Grafik
Problem
Ein Rechtsklick auf das Diagramm-Objekt soll eine Meldung aufrufen, ohne dass ein Diagramm-Kontextmenü angezeigt wird.
ClassModule: DieseArbeitsmappe
Private Sub Workbook_Open()
Worksheets("Tabelle1").Select
Set rng = ActiveCell
End Sub
ClassModule: Tabelle1
Dim MeinDiagramm As New Klasse1
Private Sub Worksheet_Activate()
Set MeinDiagramm.Diagramm = ChartObjects(1).Chart
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set rng = ActiveCell
End Sub
ClassModule: Klasse1
Dim MyButton As Long
Public WithEvents Diagramm As Chart
Private Sub Diagramm_BeforeRightClick(Cancel As Boolean)
If MyButton = xlSecondaryButton Then
Cancel = True
MsgBox "Hallo User!"
End If
End Sub
Private Sub Diagramm_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)
MyButton = Button
End Sub
Private Sub Diagramm_Select(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long)
Call Diagramm_BeforeRightClick(True)
rng.Select
End Sub
StandardModule: Modul1
Public rng As Range