如何使用vba更新powerpoint 2010中嵌入的excel链接 [英] How to update embeded excel links in powerpoint 2010 using vba
本文介绍了如何使用vba更新powerpoint 2010中嵌入的excel链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的问题是我已将我的图表粘贴到 powerpoint 我正在尝试通过Excel-VBA更新嵌入式链接。
My problem is i have pasted my charts into powerpoint and I am trying to update the embedded links via Excel-VBA.
我尝试过以下代码失败:
I have tried the codes below and failed:
代码1 p>
code 1
AppPPT.Presentations.Open "D:\Demo.pptx", Untitled:=msoTrue
AppPPT.ActivePresentation.UpdateLinks
AppPPT.ActivePresentation.SaveAs "D:\Demo.pptx"
代码2
For i = 1 To AppPPT.ActivePresentation.Slides.Count
For s = 1 To AppPPT.ActivePresentation.Slides(i).Shapes.Count
If AppPPT.ActivePresentation.Slides(i).Shapes(s).Type = msoLinkedOLEObject Then
AppPPT.ActivePresentation.Slides(i).Shapes(s).LinkFormat.Update
End If
Next s
Next i
代码3
Set PPTTemplate = AppPPT.Presentations.Open("D:\Demo.pptx")
' update chart
Dim osld As Slide
Dim oshp As PowerPoint.Shape
For Each osld In PPTTemplate.Slides
For Each oshp In osld.Shapes
With oshp
If .HasChart Then
.Chart.ChartData.Activate
.Chart.ChartData.Workbook.Close
.Chart.Refresh
End If
End With
Next oshp
Next osld
AppPPT.Activate
推荐答案
我已经实现了, / p>
I have achieved it by spending some days trying on it
AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.Update
和BreakLines代码
and BreakLines code
AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.BreakLink
这篇关于如何使用vba更新powerpoint 2010中嵌入的excel链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文