我正在尝试使用此代码使用Excel VBA断开powerpoint中的链接:
Sub BreakAllExcelLinks()
Dim shp As Shape
Dim sld As PowerPoint.Slide
Dim PPT As PowerPoint.Application
'Loop Through Each Slide in ActivePresentation
For Each sld In PPT.ActivePresentation.Slides
For Each shp In sld.Shapes
On Error Resume Next
shp.LinkFormat.BreakLink
On Error GoTo 0
Next shp
Next sld
End Sub
但是,当我每次都运行它时,会出现此错误:
对象变量或未设置块
在活动演示文稿中每张幻灯片的第一张。我做错了什么?