我的问题是我已将图表粘贴到微软幻灯片软件 /questions/tagged/powerpoint我正在尝试通过 Excel-VBA 更新嵌入的链接。
我尝试过下面的代码但失败了:
code 1
AppPPT.Presentations.Open "D:\Demo.pptx", Untitled:=msoTrue
AppPPT.ActivePresentation.UpdateLinks
AppPPT.ActivePresentation.SaveAs "D:\Demo.pptx"
code 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
code 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
我花了几天时间尝试才实现了它
AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.Update
和断线代码
AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.BreakLink
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)