Consulting

Results 1 to 3 of 3

Thread: Remove Data Labels

  1. #1

    Remove Data Labels

    Hello all,

    I am writing vba code for removing data labels for the charts type 100% stacked bar in ppt 2007. Below is the code, I have created. This gives the error message "This member can only be accessed for a chart object". Please help in this code.



    Dim sld As Slide
    Dim shp As Shape

    For Each sld In ActivePresentation.Slides
    For Each shp In sld.Shapes
    If shp.HasChart And shp.Chart.ChartType = 59 Then
    shp.Chart.ApplyDataLabels xlDataLabelsShowNone
    End If

    Next shp
    Next sld

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    I suspect this line is the problem

    [vba]If shp.HasChart And shp.Chart.ChartType = 59 Then[/vba]
    The And shp.ChartType is being checked even if hasChart is false and giving an error.

    Try

    [VBA]If shp.HasChart Then
    If shp.Chart.ChartType = 59 Then[/VBA]
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3

    Thanks

    Thanks John, It's working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •