1、打开想要提取的PPT文件
2、按住 Alt+f11进入Microsoft Visual Basic for Applications
3、在左边的工程窗口空白处右键,选择 “插入”---“模块”
然后中间会出现一个代码编辑区
4、在最上方菜单栏找到“工具”点击选择“引用”,然后会弹出下面这个框框,找到Microsoft Word x Object Library(x代表版本数),然后打上勾勾,点击确定
5、在中间代码块复制如下代码
Sub Main()
On Error Resume Next
Dim temp As New Word.Document, tmpShape As Shape, tmpSlide As Slide
For Each tmpSlide In ActivePresentation.Slides
For Each tmpShape In tmpSlide.Shapes
temp.Range().Text = temp.Range() + tmpShape.TextFrame.TextRange.Text
Next tmpShape
Next tmpSlide
temp.Application.Visible = True
End Sub
如图所示:
6、按下F5,等待文本提取,稍后可以看见下方任务栏出现了一个word,那就是我们需要的文件啦
点击去就能看到PPT的文本已经提取到word中啦!