cheatah قام بنشر مايو 5 مشاركة قام بنشر مايو 5 Private Sub Workbook_Open() Dim a As Date Dim b As Date Sheet4.Range("z1").Value = Date a = Sheet4.Range("z1").Value b = "01-10-2024" Dim myvalue As String myvalue = InputBox("enterpassword") If myvalue = 123 Or a >= b Then ActiveSheet2.Unprotect Password:="55" ActiveSheet3.Unprotect Password:="55" Application.ScreenUpdating = False Application.EnableEvents = False Sheet2.Range("a1:z700").Clear Sheet2.Range("a1:z700").Interior.Color = vbBlack Sheet13.Range("a1:z700").Clear Sheet13.Range("a1:z700").Interior.Color = vbBlack Application.ScreenUpdating = True Application.EnableEvents = True ActiveSheet2.Protect Password:="55", DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet3.Protect Password:="55", DrawingObjects:=True, Contents:=True, Scenarios:=True MsgBox "expire" ThisWorkbook.Save Application.Quit End If End Sub علما بأن كلمة المرور 123 ورمز الحماية لورقة العمل هي 55 12 - Copy.xlsb رابط هذا التعليق شارك More sharing options...
Saleh Ahmed Rabie قام بنشر مايو 24 مشاركة قام بنشر مايو 24 **تصحيح الكود:** Private Sub Workbook_Open() Dim a As Date Dim b As Date Sheet4.Range("z1").Value = Date a = Sheet4.Range("z1").Value b = "01-10-2024" Dim myvalue As String myvalue = InputBox("enterpassword") If myvalue = "123" Or a >= b Then ActiveSheet2.Unprotect Password:="55" ActiveSheet3.Unprotect Password:="55" Application.ScreenUpdating = False Application.EnableEvents = False Sheet2.Range("a1:z700").Clear Sheet2.Range("a1:z700").Interior.Color = vbBlack Sheet13.Range("a1:z700").Clear Sheet13.Range("a1:z700").Interior.Color = vbBlack Application.ScreenUpdating = True Application.EnableEvents = True ActiveSheet2.Protect Password:="55", DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet3.Protect Password:="55", DrawingObjects:=True, Contents:=True, Scenarios:=True MsgBox "expire" ThisWorkbook.Save Application.Quit End If End Sub ``` **التغييرات التي تم إجراؤها:** * تم وضع كلمة المرور بين علامتي اقتباس مزدوجتين في جملة `If`. * تمت إضافة نقطة فاصلة بعد `a` في جملة `If` لفصلها عن `b`. **ملاحظات:** * تأكد من إدخال كلمة المرور الصحيحة في مربع الإدخال. * تأكد من أن تاريخ انتهاء الصلاحية المحدد في `b` صحيح. رابط هذا التعليق شارك More sharing options...
الردود الموصى بها
من فضلك سجل دخول لتتمكن من التعليق
ستتمكن من اضافه تعليقات بعد التسجيل
سجل دخولك الان