vba Project加密及解密

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 GetData = "CMG=""" Then CMGs = I
        If GetData = "[Host" Then DPBo = I - 2: Exit For
    Next
   
    If CMGs = 0 Then
       MsgBox "請先對VBA編碼設置一個保護密碼...", 32, "提示"
       GoTo clo
    End If
posted @ 2009-12-07 12:08  与时俱进  阅读(1631)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈