对于PowerPoint VBA来说还是个新手 - 我的印象是,这是用于执行基本查找和放大的样板代码。整个幻灯片放映(在这种情况下是前5张幻灯片)。但是,我在Run-time error 13 - Type mismatch
上获得For Each shp In sld.Shapes
,我无法弄清楚原因。有什么见解吗?
Dim sld As Slide, shp As Shape, i As Long
For i = 1 To 5
Set sld = PPT.ActivePresentation.Slides(i)
For Each shp In sld.Shapes '<- Error here
If shp.HasTextFrame Then
If shp.TextFrame.HasText Then
shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "LastMonth", "September")
End If
End If
Next shp
Next i
答案 0 :(得分:2)
Excel Shape
与Powerpoint Shape
不同:您需要使用PowerPoint库限定声明。
Dim shp as PowerPoint.Shape