اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الرجاء تصحيح الكود التالي الخاص بانتهاء صلاحية شيت اكسيل


الردود الموصى بها

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

رابط هذا التعليق
شارك

  • 3 weeks later...

**تصحيح الكود:**

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` صحيح.

 

رابط هذا التعليق
شارك

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information