我的 "Object variable or With block variable not set"
代码出现错误。这是我第一次写宏。我确实有编程知识,但这对我来说是新的。
无论如何,我想通过演示文稿,并且对于在注释部分中有任何文本的每一页,我想添加一张包含该文本的新幻灯片(在它之后)。
这是我尝试过的:
Sub SlideSort()
Dim curSlide As Slide
Dim newSld As Slide
Dim curPres As Presentation
Dim curShape As Shape
Dim i As Integer
For i = 1 To ActivePresentation.Slides.Count
curSlide = ActivePresentation.Slides(i)
For Each curShape In curSlide.NotesPage.Shapes
If curShape.Type = msoPlaceholder Then
If curShape.PlaceholderFormat.Type = ppPlaceholderBody Then
If curShape.TextFrame.TextRange <> "" Then
Set newSld = ActivePresentation.Slides.Add(Index:=i + 1, Layout:=ppLayoutText)
newSld.Shapes(2).TextFrame.TextRange = curShape.TextFrame.TextRange
i = i + 1
End If
End If
End If
Next curShape
Next i
End Sub
给出错误的行是 curSlide = ActivePresentation.Slides(i)