none
Edit embedded waterfall chart in PowerPoint RRS feed

  • Question

  • I am trying to change the source data for an embedded waterfall chart but the .ChartData.Workbook property is not available. 

    The old chart types work fine with the code below, but it seems to be a bug with the new chart types in MS Office 2016. 
    The first line of this code is making the macro crash. 

    '   Set source data to chart
        Set wbChart = cfSlide.Shapes("CFChart").chart.ChartData.Workbook
        Set wsChart = wbChart.Worksheets(1)


    If there are any suggestions for a possible work around until the bug is fixed, please let me know. 

    Thanks in advance. 

    Lars 
    Monday, July 18, 2016 2:41 PM

Answers

All replies

  • Hi Lars Kleiven,

    you had mentioned that the line you had mentioned above crashed the macro.

    when it get crashed did you got any error message?

    if you got any error please tell us so that we can know about that.

    you had mentioned that ,".ChartData.Workbook property is not available. "

    please refer the link below will give you information regarding this property.

    ChartData.Workbook Property (PowerPoint)

    in the link they had mentioned that

    so as per documentation please try to Activate it and let us know it worked for you or not.

    if not then please try to provide your demo code so that we can make a test with it on our side.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 19, 2016 4:30 AM
    Moderator
  • I tried to activate the property first, but it did not get me any further. The code still crashes at the same line, throwing the following error: 

    Run-time error '-2147467259 (80004005)':
    Method 'Workbook' of object 'ChartData' failed

    The code is used as a help-method to a more complex macro-structure, using global variables declared in set-up methods. Due to confidentiality I cannot provide larger clip outs. 

    The clue is however that I in this case have a slide with an embedded waterfall chart. The only task my macro should do is to set the source data in the embedded Excel sheet.

    For the old chart types, the code above (even without the 'activate' command first) lets me access the workbook and set the source data.

    Tuesday, July 19, 2016 7:57 AM
  • Hi Lars Kleiven,

    I have demo code to assign data to chart and I find that it is working with other charts but when I use waterfall chart I get a same error like you.

    below is my demo code.

    Sub CreateChart()
    Dim myChart As Chart
    Dim gChartData As ChartData
    Dim gWorkBook As Excel.Workbook
    Dim gWorkSheet As Excel.Worksheet
    
    ' Create the chart and set a reference to the chart data.
    Set myChart = ActivePresentation.Slides(1).Shapes(1).Chart
    Set gChartData = myChart.ChartData
    
    ' Set the Workbook and Worksheet references.
    Set gWorkBook = gChartData.Workbook
    Set gWorkSheet = gWorkBook.Worksheets(1)
    
     ' Add the data to the workbook.
    gWorkSheet.ListObjects("Table1").Resize gWorkSheet.Range("A1:B5")
    gWorkSheet.Range("Table1[[#Headers],[Series 1]]").Value = "Items"
    gWorkSheet.Range("a2").Value = "Coffee"
    gWorkSheet.Range("a3").Value = "Soda"
    gWorkSheet.Range("a4").Value = "Tea"
    gWorkSheet.Range("a5").Value = "Water"
    gWorkSheet.Range("b2").Value = "1000"
    gWorkSheet.Range("b3").Value = "2500"
    gWorkSheet.Range("b4").Value = "4000"
    gWorkSheet.Range("b5").Value = "3000"
    
    ' Apply styles to the chart.
    With myChart
        .ChartStyle = 4
        .ApplyLayout 4
        .ClearToMatchStyle
    End With
    
    ' Add the axis title.
    With myChart.Axes(xlValue)
        .HasTitle = True
        .AxisTitle.Text = "Units"
    End With
     
    'myChart.ApplyDataLabels
    
    ' Clean up the references.
    Set gWorkSheet = Nothing
    ' gWorkBook.Application.Quit
    Set gWorkBook = Nothing
    Set gChartData = Nothing
    Set myChart = Nothing
    
    End Sub

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 19, 2016 9:06 AM
    Moderator
  • Hi Lars Kleiven,

    As you see in my previous post that I reproduce this issue.

    and its like that This is currently not supported by Waterfall chart.

    so you can submit your feedback regarding this issue to Excel User Voice.

    Excel User Voice

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 27, 2016 1:11 AM
    Moderator