Activate right-click on picture

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,832
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
The code below does something to my charts uponn right clicking, so I would like to adapt it to my picture.

This is in a standard module:

Code:
Option Explicit

Dim MyChartsColl As Collection

Sub InitializeChart()

Dim MyChartHandler As ClsChartEvent
Dim MyChtObj As ChartObject

Set MyChartsColl = New Collection

For Each MyChtObj In Sheet1.ChartObjects

    Set MyChartHandler = New ClsChartEvent
    Set MyChartHandler.MyClsChartEvent = MyChtObj.Chart
    
    MyChartsColl.Add Item:=MyChartHandler
    
Next MyChtObj

End Sub

This is in a class, ClsChartEvent:

Code:
Option Explicit

Public WithEvents MyClsChartEvent As Chart

Private Sub MyClsChartEvent_MouseDown(ByVal Button As Long, _
                                      ByVal Shift As Long, _
                                      ByVal X As Long, _
                                      ByVal Y As Long)

Select Case Button

    Case 1
            
    Case Else
            
End Select
 
End Sub

With my picture, what should these be?

Code:
Dim MyChartHandler As ??
Dim MyChtObj As ??

For Each MyChtObj In Sheet1.??

    Set MyChartHandler = New ClsChartEvent
    Set MyChartHandler.MyClsChartEvent = MyChtObj.??
    
    MyChartsColl.Add Item:=MyChartHandler
    
Next MyChtObj


Public WithEvents MyClsChartEvent As ??

Thanks
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,214,840
Messages
6,121,895
Members
449,058
Latest member
Guy Boot

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top