1. 点击工具??>宏??>宏
2. 弹出一个宏创建窗体,在窗口中输入宏名(例如:宏名:ExtractFlash)点击创建按钮。
3. 弹出一个编程界面,在界面的中间有一个小窗口,在窗口中输入下面的程序段。
代码如下:
================================================================
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. 按F5运行宏。
5. 弹出一个选择文件的窗口,选择你想要提取flash的excel文件,点击打开按钮。
6. 这时会弹出一个提示窗口“以....名字保存”,点击确定。
7. 在excel所在的位置会产生一个同名的flash文件。到此flash文件已经导出了。
一般的操作很难导出,只能采取分析文件的办法导出,因为SWF是有数据格式的,有不一样的PE头,所有能够分析导入。