1. 新建一个Excel文件

2.在工具菜单中,选择"宏"–>"宏",如下图:

从Excel中提取Flash-1

3. 输入宏名,例如getflash,如下图:

从Excel中提取Flash-2

4.点击"创建"会进入"Microsoft Visual Basic"编辑器,删除编辑器中全部内容,用下面的内容替代:

Sub getflash()
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", , "请选择一个包含Flash的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
5.拷贝后,按F5键或点击上方的"运行"按钮执行,如下图:
从Excel中提取Flash-3 
6.运行后,会弹出如下窗口,在其中选择待提取Flash所在的Excel文件
从Excel中提取Flash-4 
7.选中后,文件中包含的Flash会保存在excel文件所在的同一个目录,至此已经完成提取的工作。
(完)

标签: ,
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

5,477次阅读 | penddy on 2008-12-26 16:42 | File Under 软件 | No Comments -