Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Capture Events on programmatically generated Charts

Excel 2003, I create a chart programmatically. Now I would like to capture
Click Events on that chart I just created. It doesn't seem I can put code
under that object via code.

My actual situation is I have run time data, and my customer and I have not
been able to come up with a programmatic way of reliably finding certain
sections of data to be used for further calculations. (His current method is,
"I look at it")

My thought was to display a graph of the data, using builtin excel tools,
and eventually let him pick points. Maybe an alt-click or something on a
series would pop up a menu where he could designate which one of three
sections this is. Based on that selection I could process N points around it
or whatever.

Since I'm still trying to figure out how to do this, any ideas on how I
could detect a click on a chart/series that doesn't exist at code time would
be appreciated.

Thanks, Bob

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Capture Events on programmatically generated Charts

You can use the chart's events in the worksheet that contains the chart. For
example, in the Sheet1 module in the VBAProject for the workbook, use the
following code:

Public WithEvents CHT As Excel.Chart
Private Sub CHT_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As
Long, _
ByVal Arg2 As Long, Cancel As Boolean)
Cancel = True
''''''''''''''''''''''''''''''''''''''''''''
' YOUR CODE HERE
''''''''''''''''''''''''''''''''''''''''''''
MsgBox "You are here"
End Sub

Then you need to Set CHT to the chart:

Sub InitCHT()
Set Sheet1.CHT = Sheet1.ChartObjects(1).Chart
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"INTP56" wrote in message
...
Excel 2003, I create a chart programmatically. Now I would like to capture
Click Events on that chart I just created. It doesn't seem I can put code
under that object via code.

My actual situation is I have run time data, and my customer and I have
not
been able to come up with a programmatic way of reliably finding certain
sections of data to be used for further calculations. (His current method
is,
"I look at it")

My thought was to display a graph of the data, using builtin excel tools,
and eventually let him pick points. Maybe an alt-click or something on a
series would pop up a menu where he could designate which one of three
sections this is. Based on that selection I could process N points around
it
or whatever.

Since I'm still trying to figure out how to do this, any ideas on how I
could detect a click on a chart/series that doesn't exist at code time
would
be appreciated.

Thanks, Bob


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Capture Events on programmatically generated Charts

Hmmm, I hadn't realized I could do this on a sheet module (as opposed to a
standalone chart events class module). Very interesting. I already have a
project that could benefit. Thanks.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Chip Pearson" wrote in message
...
You can use the chart's events in the worksheet that contains the chart.
For example, in the Sheet1 module in the VBAProject for the workbook, use
the following code:

Public WithEvents CHT As Excel.Chart
Private Sub CHT_BeforeDoubleClick(ByVal ElementID As Long, ByVal Arg1 As
Long, _
ByVal Arg2 As Long, Cancel As Boolean)
Cancel = True
''''''''''''''''''''''''''''''''''''''''''''
' YOUR CODE HERE
''''''''''''''''''''''''''''''''''''''''''''
MsgBox "You are here"
End Sub

Then you need to Set CHT to the chart:

Sub InitCHT()
Set Sheet1.CHT = Sheet1.ChartObjects(1).Chart
End Sub


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"INTP56" wrote in message
...
Excel 2003, I create a chart programmatically. Now I would like to
capture
Click Events on that chart I just created. It doesn't seem I can put code
under that object via code.

My actual situation is I have run time data, and my customer and I have
not
been able to come up with a programmatic way of reliably finding certain
sections of data to be used for further calculations. (His current method
is,
"I look at it")

My thought was to display a graph of the data, using builtin excel tools,
and eventually let him pick points. Maybe an alt-click or something on a
series would pop up a menu where he could designate which one of three
sections this is. Based on that selection I could process N points around
it
or whatever.

Since I'm still trying to figure out how to do this, any ideas on how I
could detect a click on a chart/series that doesn't exist at code time
would
be appreciated.

Thanks, Bob




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Capture Events on programmatically generated Charts

Hi,

Have a read of Jon Peltier's article,
http://www.computorcompanion.com/LPMArticle.asp?ID=221

He also has a couple of files you can down load. Links can be found at
http://peltiertech.com/Excel/Charts/ChartIndex.html#E

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"INTP56" wrote in message
...
Excel 2003, I create a chart programmatically. Now I would like to capture
Click Events on that chart I just created. It doesn't seem I can put code
under that object via code.

My actual situation is I have run time data, and my customer and I have
not
been able to come up with a programmatic way of reliably finding certain
sections of data to be used for further calculations. (His current method
is,
"I look at it")

My thought was to display a graph of the data, using builtin excel tools,
and eventually let him pick points. Maybe an alt-click or something on a
series would pop up a menu where he could designate which one of three
sections this is. Based on that selection I could process N points around
it
or whatever.

Since I'm still trying to figure out how to do this, any ideas on how I
could detect a click on a chart/series that doesn't exist at code time
would
be appreciated.

Thanks, Bob


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Charts generated by Data Analysis/Regression Add-in [email protected] Charts and Charting in Excel 7 April 3rd 07 11:29 PM
Events on controls generated on the fly... ste Excel Programming 1 September 1st 06 07:41 PM
How do you capture events? Scott buckwalter Excel Programming 2 August 12th 05 05:34 PM
Capture Excel Events from other application George[_25_] Excel Programming 5 February 26th 05 11:49 PM
Trapping Events generated by a Worksheet debartsa Excel Programming 3 November 28th 03 01:42 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"