• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Chart Events (non-embedded)

Coko

New Member
Before Excel 2010, I had no problems running VBA code such as the following:

Code:
Private Sub Chart_MouseUp(ByVal Button As Long, _
 ByVal Shift As Long, ByVal X As Long, ByVal Y As Long)
 MsgBox "Button = " & Button & Chr$(13) & _
 "Shift = " & Shift & Chr$(13) & _
 "X = " & X & " Y = " & Y
End Sub

Note: This codes is cut and paste from msdn.microsoft.com. I have right clicked on the chart tab, clicked "View Code" and pasted this code within. I then click on the chart. No message boxes pop up. I've tried mouseup, mousedown, and mousemove events. For a brief time last night, the mouseup event was working and would detect the shift, and alt key. However, it would not detect the ctrl key. But it doesn't work now.

Any advise?
 
It only works in the Plot area, or on elements outside the plot area, not on the blank Chart Area. (that's why the Ctrl key is not detected - it selects the Chart Area.)
 
Coko

With the introduction of Excel 2007, MS introduced a new charting engine

Some of the functionality has been lost

The Mouse_Up event is still available for charts but only when they are on a Chartsheet, not embeded in a Worksheet

upload_2015-12-4_22-56-18.png
 
Thank you,

I have attached the actual excel file. I am working with the chart on a chartsheet. At present, I can't get the mouseup event to fire.

Thank you
 

Attachments

  • Example with Chart Events.xlsm
    20.3 KB · Views: 3
Thank you. I'm not surprised. They used to work for me too. I'm on my 2nd computer since I first noticed this problem. Any ideas what the problem could be?
 
I have discovered that when I disable the COM Add-In called Pi Datalink, the chart events now work. Unfortunately, this is an add-in I use many times a day. Has anyone else had this issue, and found a work-around?
 
Hi ,

If you do run the ADD-IN , can you type in the following in the Immediate window of your Visual Basic Editor , and see what is displayed ?

?Application.EnableEvents

Narayan
 
Thanks Narayan. When I first started the spreadsheet this morning, the event trapping worked. I flipped to a worksheet, and then flipped back to the chart, and the event trapping no longer worked. I went to the immediate window and did a ?Application.EnableEvents and it returned false. I then typed in Application.EnableEvents = true and hit enter. The event trapping worked again. I flipped to a worksheet, and flipped back, and it quit working. This is repeatable. So there is evidentally something turning off events on me. Any thoughts on how I can avoid this?
 
When I diable the COM add-in, I can flip back and forth between the chart and worksheets and the event code will continue to trigger. So I think the COM add-in is the culprit. I can turn off the COM add-in, but I use it many times a day to pull data into Excel.....the same data that I am charting and want to use the Events with. So this is not convenient. Is there any way to "over-rule" the COM add-in so it can't turn off events on me?
Thank you.
 
I doubt it, without disabling it. You should contact the developer and find out why it's doing this - it seems like a bug.
 
Back
Top