首页 文章

如何将PowerPoint幻灯片更改写入文件?

提问于
浏览
2

我希望每次在PowerPoint中更改幻灯片(下一个/后一个)时写入文件 .

使用presentation.pps我想在文件中写入类似于:

  • 演示文稿 - 幻灯片1 - 11h04m03s

  • 演示文稿 - 幻灯片2 - 11h04m34s

有谁知道如何做到这一点?

1 回答

  • 2

    好的,所以这就是你需要做的 . 请注意一件事 - PPS不包括在打开PPS时启动宏的方法 . 如果您需要该功能,请改为创建加载项(ppa) .

    对于PPS,创建一个模块和一个类 . (如果您不确定如何执行此操作,则可能需要在继续之前更多地研究对象模型) . 该模块可以命名为任何东西 . 将类命名为“ clsWriteToFile ” . 在 clsWriteToFile 中,输入以下内容:

    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
    

    您需要编写代码以从文件读取/写入 . FileSystemObject在这方面很有用 .

    要在不进入VBA的情况下使用PPS,您必须在实际幻灯片上设置手动触发器 . 一个例子是在第一张幻灯片上添加一个形状,就像圆形矩形一样 . 添加它并键入"Start Show" . 然后,添加 Action . 该操作将在“ Mouse_Click "->" Run Macro ”上,然后选择 StartLogging 子例程 .

    就是这样 .

    如果您使用的是PPA而不是PPS,则可以通过命名“ StartLogging " routine to " Auto_Open ”来删除对最后一步的需要 .

相关问题