• 提取嵌入excel或word中flash的VBA代码




    文章来至以下链接:http://cat14051.mysinablog.com/index.php?op=ViewArticle&articleId=555049

    因连续几天都有朋友发来嵌入Excel的Flash小游戏,由此想到提取出来

    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

  • 相关阅读:
    (转)基于REST架构的Web Service设计
    WPF 简易的喷泉效果
    C# 取Visio模型信息的简易方法
    WPF TextBox按字节长度限制输入
    NPOI导出WPF DataGrid控件显示数据
    WPF--TextBlock的ToolTip附加属性
    【转】WPF 从FlowDocument中找到Hyperlink
    WPF 初学VisifireChart
    WPF 简易进度条效果
    WPF 简易的跑马灯效果
  • 原文地址:https://www.cnblogs.com/micronm/p/1888489.html
Copyright © 2020-2023  润新知