Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scatter Chart SeriesCollection(i).Points(j).HasDataLabel Properties

Status
Not open for further replies.

PWD

Technical User
Jul 12, 2002
823
0
0
GB
This is in PowerPoint 2010.

Good afternoon, I'm trying to see if I can amend the following code that I've inherited
Code:
    Set sh = ActiveWindow.Selection.ShapeRange(1)
    
    If sh.Type = msoEmbeddedOLEObject Then
    
        Set gr = sh.OLEFormat.Object
        Set chg = gr.Application.Chart

For i = 1 To 29
....

..........

                For j = 1 To 29

                    On Error Resume Next 'e.g. when there's nothing there
                    With chg.SeriesCollection(i).Points(j)
                        .HasDataLabel = True
                        .DataLabel.ShowValue = False
                        .DataLabel.ShowSeriesName = True
                        .DataLabel.Position = xlLabelPositionLeft
                    End With
                    On Error GoTo 0 'Reset error handling

                Next j
so it will only run if there is something in
Code:
.DataLabel.ShowValue
Trouble is I can't figure out the syntax to do it!! I appear to be able to do this one level up with
Code:
If chg.SeriesCollection(i).HasDataLabels Then

I just think it might be a bit tidier. It's no biggy if it can't be done; HOWEVER a BIG issue is that this data label appears to remove & replace the chg.SeriesCollection(i).DataLabels.ShowSeriesName that gets set in the code prior to this point.

Any help would be gratefully received.

Many thanks,
D€$
 


hi,

BTW, in Office 2007+ the Chart object is consistent across the applications. So it is the same object you would find in Excel, for instance.

What do you want the code to do?

Have you checked out the ApplyDataLabels Method? Can apply DataLabels to CHART, SERIES or POINT.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Hi Skip, I've just had a look at this on the InterWeb - useful, thanx. As far as I can tell this code is used to refresh a scatter chart from (presumably) a revised datasheet. I only got involved as the existing code would remove the data labels and then reinstate them - BUT some had existing simple formatting applied - bold, red & underline - which got lost in the process. What I wanted to do was to identify which out of the n number of cells actually had values (and, therefore, labels), set variables for those formatting elements then re-apply that formatting after the data labels had been reinstated. As I said I found I was able to do this for each i in
Code:
SeriesCollection(i)
with
Code:
If chg.SeriesCollection(i).HasDataLabels Then
and do that at that level but I couldn't find the equivalent code for each j
Code:
SeriesCollection(i).Points(j)

TBH I don't know what's the difference between SeriesCollection(i) and SeriesCollection(i).Points(j) as the latter's label appears to replace the former's label when the code runs! :(

Many thanks,
D€$
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top