PPT事件
PPT的事件无法在slde模块直接录入,需要通过创建类并实例化来完成
一、在class模块
1 Option Explicit 2 Public WithEvents pptApp As Application 3 4 Private Sub Class_Initialize() 5 MsgBox "实例化了PPT类" 6 End Sub 7 8 Private Sub pptApp_WindowSelectionChange(ByVal Sel As Selection) 9 MsgBox "WindowSelectionChange事件发生" 10 End Sub
二、在模块内 1
3 Option Explicit 2 Private ppt As New pptClass 4 Sub initializeMain() 5 Set ppt.pptApp = Application 6 End Sub 7 8 Sub extClass() 9 Set ppt= Nothing 10 End Sub 11
12 '在鼠标单击动画或确定动画时长时(但在动画对象出现之后)发生此事件。 13 Sub OnSlideShowNextBuild(ByVal Wn As SlideShowWindow) 14 MsgBox Wn.Width 15 End Sub 16 '单击上一张时触发 17 Sub OnSlideShowPreviousBuild(ByVal Wn As SlideShowWindow) 18 MsgBox Wn.Height 19 End Sub 20 ' -----------------------------下面两个可用来初始化数据------------------------- 21 '在换片之后激活事件 22 Sub OnSlideShowPageChange(ByVal Wn As SlideShowWindow) 23 24 End Sub 25 '在结束放映后激活事件。 26 Sub OnSlideShowTerminate(ByVal Wn As SlideShowWindow) 27 call extClass 28 End Sub