1

Seems you can type anything you want into a date picker field. Is there a way to force the user to enter a valid date in the proper format (dd-mm-yyyy vs mm-dd-yyyy)

1
  • what field do you think? I think a proper date picker won't accept incorrect data. Commented Jan 21, 2016 at 14:17

2 Answers 2

3

I know it's a couple of years since the question was asked but there seems to be a lack of information about this as of November 2018.

The Word Date Picker Content Control allows a date to be selected by clicking the drop-down and it also allows the user to pick free text. By default there is no validation of the free text so the user can happily enter "31st September", "In a while", "fdjfjfjf" or whatever text they like.

As far as I have been able to ascertain, the only way to validate the field is by using VBA.

ContentControls provide an OnExit event which can be used:

    Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
        If (ContentControl.Type = wdContentControlDate) And (Not IsDate(ContentControl.Range.Text)) Then
            MsgBox "Please enter a valid date"
            Cancel = True
        End If
    End Sub

This is triggered when the user exits any Content Control. If the control was a date picker and did not contain a valid date then a message advises the user to enter a valid date.

0

If this is your question this answer may be useful,

Inserting the current date in short cut is SHIFT+ALT+D

The Date will be reflect whatever the system date format. Say if dd-mm-yyyy it will in this format. so if you want format like this you have to set system time settings like this. Whatever format you want use change the system settings accordingly.

if dd-mm-yy it will in this format.

I guess this answer little bit helpful for you

2
  • the question is about how to prevent users using wrong format. Your answer is about how to learn correct format being a user. The two are really different. Commented Jan 21, 2016 at 14:18
  • yaah.. i understood. You can use your system date settings as standard reference. By the time no need to worry about format. otherwise you may go for locking cells.
    – Photon001
    Commented Jan 21, 2016 at 14:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .