Hi,
I am Updating 2007 PPT Charts Data using Code in excel. Data files are kept in Separate Excel files.
Picking excel and updating chart. Data is in Charts Excel Sheet, However new Row or column is not reflecting in Chart.
Even Using Below Code I am Increasing the Size of Data Range, It is still not reflecting in chart. This Code I am using directly in PPT.
If I am doing Samething manually it starts Reflecting.
I am not able to use the setsourcedata Method too.
Code:
Sub Refresh()
Dim chtObj As Chart
Dim wbkCht As Object
Dim wksCht As Object
Dim objPres As Object
Dim objSld As Object
Dim objShp As Object
Set objPres = ActivePresentation
With objPres
For Each objSld In .Slides
For Each objShp In objSld.Shapes
If objShp.Type = msoChart Then
Set chtObj = objShp.Chart
With objShp.Chart.ChartData
.Activate
.Workbook.Application.WindowState = -4140
Set wbkCht = .Workbook
Set wksCht = .Workbook.worksheets(1)
.Workbook.Application.WindowState = -4140
'objShp.Chart.SetSourceData wksCht.Range("A1").CurrentRegion wksCht.ListObjects("Table1").Resize wksCht.Range("A1").CurrentRegion.Resize(wksCht.Range("A1").CurrentRegion.Rows.Count - 1, wksCht.Range("A1").CurrentRegion.Columns.Count - 1)
wksCht.ListObjects("Table1").Resize wksCht.Range("A1").CurrentRegion
End With
End If
Next
Next
End With
End Sub
Thanks In advance
Rahul Kumar Singh
Bookmarks