Option Explicit Dim Q Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.EnableCancelKey = xlDisabled If Q = 1 Then Exit Sub Sheets("宏表1").Range("b1") = 1 If Me.Saved = False Then Me.Save End Sub Private Sub Workbook_Open() Application.EnableCancelKey = xlDisabled Sheets("宏表1").Range("b1") = 2 Application.VBE.CommandBars.FindControl(ID:=752).Execute Dim P P = InputBox("请输入口令" & Chr(10) & Chr(10) & "你只有一次机会。", "文科生恳请您破解本文件") If P <> "B79DF5578@BH468%NUYR56112F004O0Y" Then MsgBox "口令不正确,文件将关闭。", 16 Q = 1 Sheets("宏表1").Range("b1") = 1 ThisWorkbook.Save ThisWorkbook.Close End If End Sub 一样的啊 |