如何将 PowerPoint 幻灯片更改写入文件? [英] How to write PowerPoint slide change to a file?

查看:45
本文介绍了如何将 PowerPoint 幻灯片更改写入文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I want to write to a file every time a slide is changed (next/back) in PowerPoint.

使用presentation.pps,我想在文件中写入如下内容:

With presentation.pps I want to write in the file something like:

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

有人知道怎么做吗?

推荐答案

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

Okay, so here's what you need to do. Note one thing important - a PPS does not include a method to have a macro start upon opening the PPS. If you want that functionality, create an add-in (ppa) instead.

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

For the PPS, create a module and a class. (If you're not sure how to do this, you may need to study the Object Model more before continuing). The module can be named anything. Name the class "clsWriteToFile". In clsWriteToFile, put the following:

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

在模块中,输入以下内容:

In the module, put the following:

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 在这方面很有用.

You'll need to write the code to read/write from a file. The FileSystemObject is useful in that regard.

要在不进入 VBA 的情况下使用 PPS 进行此操作,您必须在实际幻灯片上手动触发.一个例子是向第一张幻灯片添加一个形状,如圆角矩形.添加它并键入开始放映".然后,添加一个操作.操作将在Mouse_Click"->运行宏"上,然后选择StartLogging 子例程.

To get this working with a PPS without going into the VBA, you'll have to have a manual trigger on the actual slide. An example would be to add a shape to the first slide, like a rounded rectange. Add it and type "Start Show". Then, add an Action. The action would be on "Mouse_Click"->"Run Macro" and then choose the StartLogging sub routine.

就是这样.

如果您使用的是 PPA 而不是 PPS,您可以通过将StartLogging"例程命名为Auto_Open"来消除最后一步的需要.

If you are using a PPA instead of a PPS, you could remove the need for the last step by just naming the "StartLogging" routine to "Auto_Open".

这篇关于如何将 PowerPoint 幻灯片更改写入文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆