Consulting

Results 1 to 2 of 2

Thread: PowerPoint ChartData Reverting back to old values

  1. #1
    VBAX Newbie
    Joined
    May 2013
    Posts
    3
    Location

    PowerPoint ChartData Reverting back to old values

    I've written code to update the chart data of a chart in powerpoint:

    Set myChart = pptPres.Slides(8).Shapes("Chart 10").Chart
    
    myChart.ChartData.Activate
    Set wb = myChart.ChartData.Workbook
    Set ws = wb.Worksheets(1)
    
    For i = 1 To 7
        ws.Range("B" & i + 1).Value = Sheet1.Range("E" & i + 2).Value
    Next
    
    
    wb.Close
    The data is actually updating, but when I look at the chart, the old values still exist. But, when I right click to edit data, I see the new values. Then only once I've clicked edit data and closed the edit-data-workbook manually, do the numbers on the chart actually change.

    How can I get the values I enter with code to not revert back to the old values, since I will be using this code to loop through a number of slides/charts.

    I've tried:
    myChart.Refresh
    Which hasn't worked.

    Edit: Using PowerPoint 2007 and this code is running from Excel 2007.

    Thanks for any help!

  2. #2
    VBAX Mentor
    Joined
    Aug 2012
    Posts
    367
    Location
    This is a stab in the dark, but try hitting F9 with the excel chart open in editing mode. If it works, then the excel calculation mode might be set to manual. I have no idea how this works with embeded content, but this module is a counterpart to one I use a lot in excel to speed up the code execution, and might give you a start.

    [VBA]Public Sub ResetApp()
    ' settings to reset working environment at end of code execution
    ' may need to run this manually in event of incomplete execution of code sequence
    Application.Calculation = xlCalculationAutomatic
    Application.StatusBar = ""
    Application.ScreenUpdating = True
    End Sub[/VBA]

    Good luck
    Tim
    Remember: it is the second mouse that gets the cheese.....

Posting Permissions

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