VBA macro file source code released

VBA password releasing the Project
first process step in detail with reference to:
The following code is the second process VBA

' Needs will need to unlock the password protection before using the macro code that contains an Excel file (if it is xlsm file, you need to save as version 97-03 xls file) close 
' to create a new Excel workbook, Alt + F11 to open the VBA Editor , a new module, copy the following code 
' removable protective coding VBA 
Sub MoveProtect ()
     Dim FileName of As  String 
    FileName = Application.GetOpenFilename ( " Excel file (* * * .xls & the .xla), XLS *;.. * XLA " , , " VBA crack " )
     the If FileName = the CStr ( False ) the Then 
       the Exit Sub 
    Else 
       VBAPassword FileName, False 
    End  the If 
End Sub 
 
' provided protection coding VBA
Sub SetProtect()
    Dim FileName As String
    FileName = Application.GetOpenFilename("Excel文件(*.xls & *.xla),*.xls;*.xla", , "VBA破解")
    If FileName = CStr(False) Then
       Exit Sub
    Else
       VBAPassword FileName, True
    End If
End Sub
 
Private Function VBAPassword(FileName As String, Optional Protect As Boolean = False)
      If Dir(FileName) = "" Then
         Exit Function
      Else
         FileCopy FileName, FileName & ".bak"
      End If
 
      Dim GetData As String * 5
      Open FileName For Binary As #1
      Dim CMGs As Long
      Dim DPBo As Long
      For i = 1 To LOF(1)
          Get #1, i, GetData
          IF the GetData = " CMG =" " "  the Then CMGs = I
           IF the GetData = " [the Host "  the Then DPBO = I - 2 : the Exit  the For 
      the Next 
      IF CMGs = 0  the Then 
         MsgBox  " Please set the encoding of a password protection VBA ... " , 32 , " prompt " 
         the Exit Function 
      End  the If 
      the If Protect = False  the Then 
         Dim St of As  String * 2 
         Dim S20AS  String * . 1 
         ' to obtain a hexadecimal string 0D0A 
         the Get # . 1 , CMGs - 2 , St
          ' to obtain a string of 20 hexadecimal 
         the Get # . 1 , DPBO + 16 , S20
          ' replacing the code encryption machine part 
         the For I CMGs = the To DPBO the Step  2 
             of Put # . 1 , I, St
          the Next 
         ' added unpaired symbol 
         the If (DPBO - CMGs) Mod  2 <> 0  the Then 
            of Put # . 1 , DPBO + . 1 , S20
         End  the If 
         MsgBox  " file decryption is successful ...... " , 32 , " Tips " 
      Else 
         Dim MMs of As  String * 5 
         MMs = " DPB =" " " 
         of Put # 1 , CMGs, MMs
          MsgBox  " the success of the special file encryption. ..... " , 32 , " prompt " 
      End  the If 
      use Close # 1 
End Function
 

 

Guess you like

Origin www.cnblogs.com/m0488/p/11617683.html