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

كود اغلاق


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

Guest محمد ابو صهيب
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
MsgBox ("!الرجاء ضغط زر الخروج أسفل الواجهة..."), vbMsgBoxRight + 64, "رسالة توجيه"
Cancel = True
Exit Sub
End If
End Sub

هذا بالنسبة تعطيل الخروج من واجهة الاستخدام 

لبد أن تجعل زر الخروج في واجهة الاستخدام  وتضع فيه الكود 

أعلن عن المتغير réponse   as string 

ضع في زر الإغلاق   call fermer

 Sub fermer()
dim réponse as string
réponse = MsgBox("هل تود حفظ المعلومات فبل المغادرة ?" & Chr(13) & Chr(10) & "    نعم   للمغادرة ; لا   لغلق الملف", vbYesNoCancel + 64 + vbMsgBoxRight + vbMsgBoxRtlReading, "تأكيد الخروج ...")

If réponse = vbYes Then
      For Each Workbook In Application.Workbooks
        Workbook.Save
      Next Workbook
   Application.Quit
End If

If réponse = vbNo Then
    ActiveWorkbook.Save
   ActiveWorkbook.Close
End If

If réponse = vbCancel Then
   MsgBox ("تعذر حفظ المعلومات ")
 End If
End Sub

 

تم تعديل بواسطه محمد ابو صهيب
رابط هذا التعليق
شارك

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.

×
×
  • اضف...

Important Information