هذا الكود عند فتح الملف لاول مره يطلب باسورد وهو 2020
المشكله انه يقوم بطلب الباسورد عند فتح الملف في كل مره المطلوب ان يطلب الباسورد مره واحده فقط
هو مربوط بسيريال الهارد
المطلوب ان يقوم بطلب الباسورد مره واحده فقط وهي عند فتح الملف لاول مره ولا يقوم بطلبه مره اخرى ...... تـــــــم رفـع الـــمــــلف
Private Sub Workbook_Open()
Dim bool As Boolean
On Error Resume Next
bool = [DriveSN] = GetDriveSerialNumber
On Error GoTo 0
Application.EnableCancelKey = xlDisabled
If bool = False Then
If InputBox("Enter the Password") <> "2020" Then
MsgBox "Wrong Password ..." & vbCrLf & "Workbook Closing !", vbExclamation
Application.EnableCancelKey = xlInterrupt
Me.Close False
Else
Names.Add "DriveSN", GetDriveSerialNumber, False: Me.Save
End If
End If
Application.EnableCancelKey = xlInterrupt
End Sub
n.xlsm