Its a very common sight when we get mails sent to us with flash files embedded in it! Sometimes its a Greeting Card, a funny game or an Interesting puzzle that keeps us hooked on!
Why embed in MS Office Word/Excel?
Since most of the Office's and Personal Desktops have MS Office installed, Word and Excel act as a good container to run or play these flash (SWF a.k.a Shockwave Flash) files.
Now comes the next part, where you like the file, and want to extract it, to either save it to your desktop as flash file, or upload it your site (Free Flash Games) when the file is not under copyright policy, or various other reasons!
How to Extract the Embedded Flash Files?
Step 1: Save the file from the Mail to your desktop
Step 2: Open an Excel/Word file and go to Visual Basic Editor (Simple short cut key, Alt + F11)
Step 3: In MS Visual Basic Editor, click the View Code icon on the upper-left panel.
Step 4: Copy the below code into it and execute it (Press F5 to execute it)
Step 5: An Open File dialog box will prompt you to open the document which has the flash file embedded in it
Step 6: A message box will pop up, with a message instructing where is the flash file saved in your system. (Usually it will be at the same place where you have saved the Excel/Word File)
Step 7: Its done, you can open this flash file with a flash player, or Internet Explorer.
Go ahead and start using this trick, if any problems do share it in the comment section or contact page! :)
This code and trick was first shared by Li
Why embed in MS Office Word/Excel?
Since most of the Office's and Personal Desktops have MS Office installed, Word and Excel act as a good container to run or play these flash (SWF a.k.a Shockwave Flash) files.
Now comes the next part, where you like the file, and want to extract it, to either save it to your desktop as flash file, or upload it your site (Free Flash Games) when the file is not under copyright policy, or various other reasons!
How to Extract the Embedded Flash Files?
Step 1: Save the file from the Mail to your desktop
Step 2: Open an Excel/Word file and go to Visual Basic Editor (Simple short cut key, Alt + F11)
Step 3: In MS Visual Basic Editor, click the View Code icon on the upper-left panel.
Step 4: Copy the below code into it and execute it (Press F5 to execute it)
Sub ExtractFlash()
Dim tmpFileName As String
Dim FileNumber As Integer
Dim myFileId As Long
Dim MyFileLen As Long
Dim myIndex As Long
Dim swfFileLen As Long
Dim i As Long
Dim swfArr() As Byte
Dim myArr() As Byte
tmpFileName = Application.GetOpenFilename("MS Office File (*.doc;*.xls), *.doc;*.xls", , "Open MS Office file")
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 "Save the extracted SWF Flash as [ " & tmpFileName & " ]"
End Sub
Step 5: An Open File dialog box will prompt you to open the document which has the flash file embedded in it
Step 6: A message box will pop up, with a message instructing where is the flash file saved in your system. (Usually it will be at the same place where you have saved the Excel/Word File)
Step 7: Its done, you can open this flash file with a flash player, or Internet Explorer.
Go ahead and start using this trick, if any problems do share it in the comment section or contact page! :)
This code and trick was first shared by Li
No comments:
Post a Comment