swayp11
05-17-2013, 05:31 PM
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!
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!