Activate right-click on picture

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,395
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:

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Watch MrExcel Video

Forum statistics

Threads
1,122,483
Messages
5,596,405
Members
414,064
Latest member
Duncthegreat

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
Top