I am using VBA to update a powerpoint presentation chart in Office 2010, as illustrated in the Microsoft article http://msdn.microsoft.com/en-us/library/gg980939(v=office.14).aspx. Though the Excel data table is indeed updated, the chart does not update if I close the Excel worksheet by calling wb.Close at the end. In this case what code may I use to update the graph/chart while closing the Excel file?
The code I used is below:
Dim shp As Shape
Set shp = ppSlide.Shapes(StrainChart)
Dim cht As Chart
Set cht = shp.Chart
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
cht.ChartData.Activate
Set wb = cht.ChartData.Workbook
Set ws = wb.Worksheets(1)
ws.Range("B2").Value = dMinThick 'max thickness
ws.Range("C2").Value = dMaxThick 'min thickness
ws.Range("B3").Value = dMinMajor 'max thickness
ws.Range("C3").Value = dMaxMajor 'min thickness
ws.Range("B4").Value = dMinMinor 'max thickness
ws.Range("C4").Value = dMaxMinor 'min thickness
wb.Close