اذهب الي المحتوي
أوفيسنا

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

قام بنشر (معدل)

السلام عليكم

حسب فهمى لطلبك وبدون ارفاق ملف منكم اليك الكود

Sub RunMacroWithPassword()
    Dim password As String
    Dim userInput As String

    password = "1234"

    userInput = InputBox("من فضلك أدخل كلمة السر لتشغيل الماكرو:", "كلمة السر")

    If userInput = password Then
        MsgBox "كلمة السر صحيحة، سيتم الآن تشغيل الماكرو.", vbInformation
       
        Call MyProtectedMacro
    Else
        MsgBox "كلمة السر غير صحيحة. لن يتم تشغيل الماكرو.", vbCritical
    End If
End Sub

Sub MyProtectedMacro()
    MsgBox "تم تشغيل الماكرو بنجاح!", vbInformation
    ' أضف الكود الحقيقي هنا...
End Sub

الكود الاول   Sub RunMacroWithPassword()    وفيه المطالبة بكلمة السر وهي 1234

والكود الثاني Sub MyProtectedMacro()    وهو الذي سيتم تنفيذه بعد وضع كلمة السر

مثال

تنفيذ ماكرو مع ادخال كلمة سر.xlsb

تم تعديل بواسطه عبدالله بشير عبدالله
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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

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

Important Information