I don't know if it's the problem, but ChartObject is a dumb choice for a
variable name, (a) since it's a keyword, and (b) since it refers to a
different object in Excel's object model.
Go to Google, and search on Excel Chart Events. The first article is a
very comprehensive guide.
- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/
On 5/3/2010 5:20 AM, kalle wrote:
Thanks for your answer
I use code that I found here.
http://www.exceltip.com/st/Chart_obj...n_Microsoft_Ex
cel/439.html
I put this in a Class module
Public WithEvents ChartObject As Chart
Private Sub ChartObject_Select(ByVal ElementID As Long, _
ByVal Arg1 As Long, ByVal Arg2 As Long)
ActiveChart.Deselect
End Sub
and then i try to run this from a standard module
Dim ChartObjectClass As New ChartEventClass
Private Sub Workbook_Open()
Set ChartObjectClass.ChartObject =
Worksheets(1).ChartObjects(1).Chart
End Sub
When I do, I get a compile error (User-defined type not defined)
What I eventually want to do is double click on a bar in the graph and
find the X category. In this case, for example, 2010-03. Then it will be
used to run a sql query to display detailed data for the month.
So with this code I just try to understan how chart envents works and if
it's possible for me to use.
*** Sent via Developersdex http://www.developersdex.com ***