tinyskills13
New Member
- Joined
- Aug 20, 2011
- Messages
- 14
I have (found) a code that returns info about a chart on the "MouseUp" event. I edited this code to go to a new chart when the user CTRL + clicks on a pie piece. So far that function is working. The other function I am looking to add is going to a list on another sheet when the user CTRL + clicks on a legend entry. However, when I click on a legend entry the code errors out at the GetChartElement method:
"Run-time error '430':
Class does not support Automation or does not support expected interface."
I'm on a Windows Vista machine and using Excel 2007. I read something about certain chart commands not working in 2007, but I am not sure if this falls in that category. It might also be helpful to know that the charts are on separate chart sheets and not normal worksheets. Small portion of code is below. Perhaps I am missing something obvious? Thanks.Class does not support Automation or does not support expected interface."
Code:
Option Explicit
Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)
Dim ElementID As Long, Arg1 As Long, Arg2 As Long
Dim myX As Variant, myY As Double, myXlen As Long
If Shift = 2 Then
With ActiveChart
' Pass x & y, return ElementID and Args
.GetChartElement x, y, ElementID, Arg1, Arg2