在VBA中从powerpoint文件中提取所有文本
我有一大堆 powerpoint 文件,我想从中提取所有文本,然后将其全部合并到一个大文本文件中。每个源 (PPT) 文件都有多个页面(幻灯片)。我不关心格式——只关心文字。
我可以通过在 PPT 中输入 ^A ^C,然后在记事本中输入 ^V 来手动完成此操作;然后在 PPT 中向下翻页,并对 Powerpoint 中的每张幻灯片重复此操作。 (太糟糕了,我不能只做一个 ^A 来抓取所有内容......然后我可以使用 sendkey 来复制/粘贴)
但是有数百个这样的 PPT,其中幻灯片数量不同。
这似乎是一件很常见的事情,但我在任何地方都找不到例子。
有人有示例代码来执行此操作吗?
I have a huge set of powerpoint files from which I want to extract all the text and just lump it all into one big text file. Each source (PPT) file has multiple pages (slides). I do not care about formatting - only the words.
I could do this manually with a file by just ^A ^C in PPT, followed by ^V in notepad; then page down in the PPT, and repeat for each slide in the powerpoint. (Too bad I can't just do a ^A that would grab EVERYTHING ... then I could use sendkey to copy / paste)
But there are many hundreds of these PPTs with different numbers of slides.
It seems like this would be a common thing to want to do, but I can't find an example anywhere.
Does anyone have sample code to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有一些代码可以帮助您入门。这会将幻灯片中的所有文本转储到调试窗口。除了转储之外,它不会尝试格式化、分组或执行任何其他操作。
Here's some code to get you started. This dumps all text in slides to the debug window. It doesn't try to format, group or do anything other than just dump.
以下示例显示了根据上面给出的 Otaku 代码循环遍历文件列表的代码:
The following example shows code to loop through a list of files based on Otaku's code given above: