【问题标题】:How to write PowerPoint slide change to a file?如何将 PowerPoint 幻灯片更改写入文件?
【发布时间】:2020-07-04 04:31:14
【问题描述】:

我想在 PowerPoint 中每次更改幻灯片(下一张/后退)时写入文件。

对于presentation.pps,我想在文件中写如下内容:

  1. 演示文稿 - 幻灯片 1 - 11h04m03s
  2. 演示文稿 - 幻灯片 2 - 11h04m34s

有人知道怎么做吗?

【问题讨论】:

  • 是的,可以这样做,但请澄清什么是“更改”。像打字一样?还是打了一封信?还是……?
  • 哦,当我们转到下一张或上一张幻灯片时

标签: vba powerpoint


【解决方案1】:

好的,这就是您需要做的。请注意一件重要的事情 - 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 进行此操作,您必须在实际幻灯片上有一个手动触发器。一个例子是向第一张幻灯片添加一个形状,如圆角矩形。添加它并键入“开始显示”。然后,添加一个动作。该操作将在“Mouse_Click”->“运行宏”上,然后选择 StartLogging 子例程。

就是这样。

如果您使用的是 PPA 而不是 PPS,则只需将“StartLogging”例程命名为“Auto_Open”即可消除最后一步的需要。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2014-01-15
  • 2013-01-15
  • 2021-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-01
相关资源
最近更新 更多