快速提取PPT课件中的多媒体资源
1、打开excel2010,新建一个excel文档,调出 开发工具。


2、在开发工具选项卡下面单击Visual Basic按钮,进入编程状态,单击插入菜单下的模块命令,在弹出的窗口中粘贴后面的VB代码。


3、VB代码:
Sub ExtractFlash()
Dim tmpFileName As String, FileNumber As Integer
Dim myFileId As Long
Dim myArr() As Byte
Dim i As Long
Dim MyFileLen As Long, myIndex As Long
Dim swfFileLen As Long
Dim swfArr() As Byte
tmpFileName = Application.GetOpenFilename("office File(*.doc;*.xls),*.doc;*.xls", , "确定要分析的 Office 档")
If tmpFileName = "False" Then Exit Sub
myFileId = FreeFile
Open tmpFileName For Binary As #myFileId
MyFileLen = LOF(myFileId)
ReDim myArr(MyFileLen - 1)
Get myFileId, , myArr()
Close myFileId
Application.ScreenUpdating = False
i = 0
Do While i < MyFileLen
If myArr(i) = &H46 Then
If myArr(i + 1) = &H57 And myArr(i + 2) = &H53 Then
swfFileLen = CLng(&H1000000) * myArr(i + 7) + CLng(&H10000) * myArr(i + 6)
CLng(&H100) * myArr(i + 5) + myArr(i + 4)
ReDim swfArr(swfFileLen - 1)
For myIndex = 0 To swfFileLen - 1
swfArr(myIndex) = myArr(i + myIndex)
Next myIndex
Exit Do
Else
i = i + 3
End If
Else
i = i + 1
End If
Loop
myFileId = FreeFile
tmpFileName = Left(tmpFileName, Len(tmpFileName) - 4) & ".swf"
Open tmpFileName For Binary As #myFileId
Put #myFileId, , swfArr
Close myFileId
MsgBox "以" & tmpFileName & "名字保存"
End Sub
4、粘贴好了以后返回到excel主界面,把该excel文档起一个你容易辨识的名字,保存为提取swf.xls,留着用来提取swf文件。打开嵌入了swf文件的ppt,在swf文件上右键单击,选择复制,新建一个excel文件,在新建的excel文件里右键粘贴,把ppt里的swf文件复制过来,起个名字,保存为excel 97—2003工作薄(*xls)(这里面的版本选择很重要,不要选错),保存好了关闭该excel。
5、打开我们第一个粘贴有代码的excel文档——提取swf.xls,在开发工具下,单击宏,弹出宏对话框,单击执行,在打开的窗口中选择粘贴有swf文件的excel文件,大功告成,里面的swf马上就会被提取出来,不信,你试试!


