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

إرغام إدخال صيغة التاريخ


إذهب إلى أفضل إجابة Solved by كمال على طارق,

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

السلام عليكم

من فضلكم كيف أعدل على الكود التالي بحيث يعطي رسالة الخطأ في حالة مخالفة الصيغة:"00/00/0000"

 

Private Sub UserForm_Initialize()

TextBox5.Value = "00/00/0000"
TextBox7.Value = "00/00/0000"
TextBox18.Value = "00/00/0000"
TextBox19.Value = "00/00/0000"
TextBox13.Value = "00/00/0000"
TextBox14.Value = "00/00/0000"





End Sub

لأ ن الكود السابق يسمح بمرور تواريخ بصيغ أخرى

وشكرا جزيلا

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

  • أفضل إجابة

وعليكم السلام - يمكنك بإستخدام هذا الكود  وتكراره لكل تكست بوكس على حده .. وطبعاً تم الرد بالكود وليس بملف لأنك لم تقم برفع ملف توضيحى من البداية لطلبك !!!

Private Sub TextBox5_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox5
        If IsDate(.Text) Then
            .Text = Format(DateValue(.Text), "dd/mm/yyyy")
        Else
            MsgBox "Not a date"
            Cancel = True
        End If
    End With
End Sub

 

  • Like 1
  • 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