Option
Explicit
Sub
refreshPPT_Charts()
Dim
oWBData
As
Excel.Workbook
Dim
pptApp
As
PowerPoint.Application
Dim
pp
As
PowerPoint.Presentation
Dim
sl
As
PowerPoint.Slide
Dim
sh
As
PowerPoint.Shape
Dim
strPOTX
As
String
Dim
strPfad
As
String
Dim
pptVorlage
As
String
Application.ScreenUpdating =
False
strPfad = "E:\WordVBA\"
strPOTX =
"Präsentation1.pptm"
Set
pptApp =
New
PowerPoint.Application
pptVorlage = strPfad & strPOTX
Set
pp = pptApp.Presentations.Open(pptVorlage)
pptApp.WindowState = ppWindowMinimized
For
Each
sl
In
pp.Slides
For
Each
sh
In
sl.Shapes
Select
Case
sh.Type
Case
3
sh.Chart.ChartData.Activate
Set
oWBData = sh.Chart.ChartData.Workbook
sh.Chart.Refresh
oWBData.Close
False
Set
oWBData =
Nothing
Case
7
Debug.Print
"can't be refreshed"
& Chr(32) & _
pptVorlage & Chr(32) & sl.Name & Chr(32) & sh.Name & Chr(32) & _
sh.OLEFormat.progID
Case
10
sh.LinkFormat.Update
End
Select
Next
sh
Next
sl
pp.Save
pp.Close
pptApp.Quit
Application.ScreenUpdating =
True
If
Not
pptApp
Is
Nothing
Then
Set
pptApp =
Nothing
If
Not
pp
Is
Nothing
Then
Set
pp =
Nothing
End
Sub