Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default XL 2003 Graphs: Retrieving Point Name

HI folks,

I'm an Access developer and my current app manipulates MS Graph
generated charts in Access. To determine code needed, I record Excel
macros, examine the resultant VBA coding and adapt it for my Access
modules.

What I'm looking to get is what one sees in controltip text when you
mouse over a column in, for example, a column chart. For example, the
controltiptext (pop up) might show:

Series "Total Costs" Point "Labour"
Value: 128423.73

I've googled the subject and combed through the object browser and have
found partial answers, but not exactly what I'm looking for.
http://tinyurl.com/kcmwx helped me figure out the series name (after I
figured out that I had to dim sr as series), but I'm still stuck on
getting the point name. For the series' names I'm able to use:

sub sSeriesNames

Dim i As Integer
Dim sr As Series

For i = 1 To ActiveSheet.ChartObjects.Count
MsgBox ActiveSheet.ChartObjects(i).Name
For Each sr In ActiveSheet.ChartObjects(i).Chart.SeriesCollection
MsgBox sr.Name
Next
Next i

End Sub


And this will display regardless of whatever has been set in the
arguments of ApplyDataLabels.

Now, how to do similar for point name (and value, for that matter)?

TIA, any help will be much appreciated.

PS, my regular news server doesn't carry this NG. Anyone know how to
change the email address that appears from Google Groups postings?

--
Tim Marshall

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default XL 2003 Graphs: Retrieving Point Name

The .XValues and .Values properties of a series return arrays containing the
X and Y values of the points in the series. It goes something like this:

sub sPointInfo()

Dim iCht As Integer
Dim sr As Series
Dim iPt as Long
dim vXVals as Variant
Dim vYVals as Variant

For iCht = 1 To ActiveSheet.ChartObjects.Count
MsgBox ActiveSheet.ChartObjects(iCht).Name
For Each sr In ActiveSheet.ChartObjects(iCht).Chart.SeriesCollect ion
' you probably don't want to use message boxes....
MsgBox sr.Name
vXVals = sr.XValues
vYVals = sr.Values
For iPt = 1 to sr.Points.Count
' you definitely don't want to use message boxes....
MsgBox "X = " & vXVals(iPt) & ", Y = " & vYVals(iPt)
Next
Next
Next i

End Sub

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


"Timmy!" wrote in message
ups.com...
HI folks,

I'm an Access developer and my current app manipulates MS Graph
generated charts in Access. To determine code needed, I record Excel
macros, examine the resultant VBA coding and adapt it for my Access
modules.

What I'm looking to get is what one sees in controltip text when you
mouse over a column in, for example, a column chart. For example, the
controltiptext (pop up) might show:

Series "Total Costs" Point "Labour"
Value: 128423.73

I've googled the subject and combed through the object browser and have
found partial answers, but not exactly what I'm looking for.
http://tinyurl.com/kcmwx helped me figure out the series name (after I
figured out that I had to dim sr as series), but I'm still stuck on
getting the point name. For the series' names I'm able to use:

sub sSeriesNames

Dim i As Integer
Dim sr As Series

For i = 1 To ActiveSheet.ChartObjects.Count
MsgBox ActiveSheet.ChartObjects(i).Name
For Each sr In ActiveSheet.ChartObjects(i).Chart.SeriesCollection
MsgBox sr.Name
Next
Next i

End Sub


And this will display regardless of whatever has been set in the
arguments of ApplyDataLabels.

Now, how to do similar for point name (and value, for that matter)?

TIA, any help will be much appreciated.

PS, my regular news server doesn't carry this NG. Anyone know how to
change the email address that appears from Google Groups postings?

--
Tim Marshall



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
How do i locate the point of intersection of two lines graphs Nana Adwoa Charts and Charting in Excel 4 April 2nd 23 07:58 PM
embedding graphs in power point CMD Excel Discussion (Misc queries) 0 May 20th 10 08:58 PM
Trouble with XY Scatter graphs Excel 2003/Office 2003 optomist1 Excel Discussion (Misc queries) 0 September 1st 09 10:07 PM
Excel 2003 Graphs Mac Excel Discussion (Misc queries) 2 June 30th 08 05:49 PM
Intersection point in graphs rk0909 Excel Discussion (Misc queries) 4 October 28th 05 09:44 PM


All times are GMT +1. The time now is 12:20 AM.

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

About Us

"It's about Microsoft Excel"