Public WithEvents PPTEvent As Application 'this is at the top of the class
Private Sub PPTEvent_SlideShowNextSlide(ByVal Wn As SlideShowWindow)
'MsgBox ActivePresentation.Slides.Item(1).SlideNumber
'This is meant to illustrate that it is here you will write what you need to the file,
'like a slide number or time stamp, etc.
End Sub
在模块中,输入以下内容:
Public newPPTEvents As New clsWriteToFile
Sub StartLogging()
Set newPPTEvents.PPTEvent = Application
'this would be the location you either create the file or open an existing one.
End Sub
1 回答
好的,所以这就是你需要做的 . 请注意一件事 - PPS不包括在打开PPS时启动宏的方法 . 如果您需要该功能,请改为创建加载项(ppa) .
对于PPS,创建一个模块和一个类 . (如果您不确定如何执行此操作,则可能需要在继续之前更多地研究对象模型) . 该模块可以命名为任何东西 . 将类命名为“ clsWriteToFile ” . 在 clsWriteToFile 中,输入以下内容:
在模块中,输入以下内容:
您需要编写代码以从文件读取/写入 . FileSystemObject在这方面很有用 .
要在不进入VBA的情况下使用PPS,您必须在实际幻灯片上设置手动触发器 . 一个例子是在第一张幻灯片上添加一个形状,就像圆形矩形一样 . 添加它并键入"Start Show" . 然后,添加 Action . 该操作将在“ Mouse_Click "->" Run Macro ”上,然后选择 StartLogging 子例程 .
就是这样 .
如果您使用的是PPA而不是PPS,则可以通过命名“ StartLogging " routine to " Auto_Open ”来删除对最后一步的需要 .