Thursday, July 12, 2007

Update All Chart Data Link

Source: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q222689

Sub UpdateAllGraphs()

Dim oShape As Shape
Dim oSlide As Slide
Dim oGraph As Object

' Loop through each slide in the presentation.
For Each oSlide In ActivePresentation.Slides

' Loop through all the shapes on the current slide.
For Each oShape In oSlide.Shapes

' Check whether the shape is an OLE object.
If oShape.Type = msoEmbeddedOLEObject Then

' Check whether the OLE object is a Graph object.
If oShape.OLEFormat.ProgID = "MSGraph.Chart.8" Then

' Found a graph; obtain object reference, and
' then update.
Set oGraph = oShape.OLEFormat.Object
oGraph.Application.Update

End If
End If
Next oShape
Next oSlide

End Sub

No comments: