|
Private Sub Workbook_Open()
Me.IsAddin = False
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Me.IsAddin = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Me.IsAddin = True
End Sub
'U盘密码狗
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fs, d, s$, checkUSB As Boolean
On Error Resume Next
checkUSB = False '默认没有找到U盘加密
For I = 3 To 26
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(Chr(64 + I) & ":")
s = d.SerialNumber
If s = "511039838" Then '当找到序号一样的盘符时
checkUSB = True 'U盘加密为真
Exit For '退出循环
End If
Next I
If Not checkUSB Then
MsgBox "找不到U盘,系统将退出。"
ThisWorkbook.Close False
Else
'欢迎页面
Dim term As Long, chk, TermDate
chk = GetSetting("swy", "Budget", "Date", "")
UserForm1.Show
Sheet15.Activate
If chk = "" Then
term = 2
Else
End If
End If
End Sub
'退出系统
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If OFF_no = 1 Then Cancel = False
If OFF_no = 0 Then Cancel = True
End Sub |
|