在任意打开的演示文稿中新建幻灯片时发生此事件,同时新演示文稿会添加到 Slides 集合中。
Private Sub application_PresentationNewSlide(ByVal Sld As Slide)
application Application 类型的对象,在类模块中声明,自身具有事件。有关使用 Application 对象的事件的详细信息,请参阅使用 Application 对象的事件。
Sld 新幻灯片。
本示例修改第三种配色方案的背景色,再将修改后的配色方案应用于新幻灯片。接下来,如果第一个形状具有文本框,则向该形状添加默认文本。
Private Sub App_PresentationNewSlide(ByVal Sld As Slide)
With ActivePresentation
Set CS3 = .ColorSchemes(3)
CS3.Colors(ppBackground).RGB = RGB(240, 115, 100)
Windows(1).Selection.SlideRange.ColorScheme = CS3
End With
If Sld.Layout <> ppLayoutBlank Then
With Sld.Shapes(1)
If .HasTextFrame = msoTrue Then
.TextFrame.TextRange.Text = "King Salmon"
End If
End With
End If
End Sub