<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My Learnings - Markish Personal Blog &#187; Extract Embedded Flash</title>
	<atom:link href="http://markish.in/tag/extract-embedded-flash/feed/" rel="self" type="application/rss+xml" />
	<link>http://markish.in</link>
	<description>It&#039;s my Blog....!</description>
	<lastBuildDate>Thu, 10 Mar 2011 08:41:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Extract a Embedded Flash from Word / Excel Doc&#8230;</title>
		<link>http://markish.in/2008/06/extract-a-embedded-flash-from-word-excel-doc/</link>
		<comments>http://markish.in/2008/06/extract-a-embedded-flash-from-word-excel-doc/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 05:58:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Extract Embedded Flash]]></category>
		<category><![CDATA[Markish]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://markishonline.com/?p=14</guid>
		<description><![CDATA[I’ve received lot of Excel / Word documents with a embedded flash in it…Today I received one.. It had a puzzle in it. It’s quite interesting ( atleast to me… ) I thought, I’d put the puzzle in my site. But I wanted to put it as a flash file not as a excel file. [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve received lot of Excel / Word documents with a embedded flash in it…Today I received one.. It had a puzzle in it. It’s quite interesting ( atleast to me… <img src='http://markish.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) I thought, I’d put the puzzle in my site. But I wanted to put it as a flash file not as a excel file. I started my search for the way to do it. Here it is….<br />
<span id="more-14"></span></br><br />
i. Save the word / excel file to a local folder<br />
ii. Open MS Excel, probably a new workbook (blank one)<br />
iii. Open the VBA Editor. (Press Alt + F11) and type the following code there</p>
<pre>
<code>
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",_
                         , "Select Excel / Word 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) = &#038;H46 Then
            If myArr(i + 1) = &#038;H57 And myArr(i + 2) = &#038;H53 Then
                swfFileLen = CLng(&#038;H1000000) * myArr(i + 7)+CLng(&#038;H10000)*myArr(i+6)+ _
                CLng(&#038;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) &#038; ".swf"
    Open tmpFileName For Binary As #myFileId
    Put #myFileId, , swfArr
    Close myFileId
    MsgBox "SaveAs " &#038; tmpFileName
End Sub
</code>
</pre>
<p>iv. Now run the code. (Press F5)<br />
v. It’ll ask for the document to process, Select the previously saved doucment.<br />
The basic logic behind this code is to<br />
i. Open the file in binary mode<br />
ii. Look for the embedded flash file in it. It’s done by searching for the signature of the SWF file within the binary data<br />
iii. Extracting the data and storing it into a file with extension SWF.<br />
That’s it…Your are done…! You get your Flash file extracted and saved in the same folder with the same name with .SWF extension.</p>
]]></content:encoded>
			<wfw:commentRss>http://markish.in/2008/06/extract-a-embedded-flash-from-word-excel-doc/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

