我有一个每周生成的ppt。我已经创建了一个用于更新链接图表的 vbscript.. 但我找不到如何识别我用于在 ppt 中创建表格的 excel 表...
Dim pptChart
Dim pptChartData
Dim xlWorkbook
Dim sld
Dim shp
'opent the ppt
strPresPath = "C:\oldpptlocation.pptx"
Set oPPTApp = CreateObject("PowerPoint.Application")
oPPTApp.Visible = True
Set oPPTFile = oPPTApp.Presentations.Open(strPresPath)
For Each sld In oPPTFile.Slides 'ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasChart Then
Set pptChart = shp.Chart
Set pptChartData = pptChart.ChartData
pptChartData.Activate
Set pptWorkbook = pptChartData.Workbook
On Error Resume Next
'update first link
pptWorkbook.UpdateLink pptWorkbook.LinkSources(1)
'On Error GoTo 0
pptChart.Refresh
pptWorkbook.Close True
End If
Next
Next
oPPTFile.SaveAs ("C:\updated_ppt.pptx")
oPPTFile.Close
oPPTApp.Quit
Set pptWorkbook = Nothing
Set pptChartData = Nothing
Set pptChart = Nothing