ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update Charts using VBA (https://www.excelbanter.com/excel-programming/330877-update-charts-using-vba.html)

Lizz45ie[_2_]

Update Charts using VBA
 

I have some Powepoint charts that are linked to Excel that should update
after I select it but it's not working. There are four charts to a
slide. The first chart on the page flickers and briefly shows the
changes but reverts back to the old data. The three other charts on
the page does not update at all. In order to update them now I need to
double click each chart on each slide for the update to occur. My
sample code is attached below. Any help will be greatly appreciated.



Sub RefreshTest()
Dim slide As slide
Dim shape As shape
Dim Graph As Object

On Error Resume Next

For Each slide In Application.ActivePresentation.Slides
For Each shape In slide.shape
If shape.Type = msoEmbeddedOLEObject Then
If shape.OLEFormat.ProgID = "MSGraph.Chart.8" Then
Then Update
Set Graph = shape.OLEFormat.Object
Graph.Application.Update
End If
End If
Next shape
Next slide

End Sub


--
Lizz45ie
------------------------------------------------------------------------
Lizz45ie's Profile: http://www.excelforum.com/member.php...o&userid=23410
View this thread: http://www.excelforum.com/showthread...hreadid=376318



All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com