Can the MS Word Date Picker force the user to enter a date?

0

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)

user3000

Posted 2016-01-18T18:28:53.560

Reputation: 129

what field do you think? I think a proper date picker won't accept incorrect data. – Máté Juhász – 2016-01-21T14:17:35.333

Answers

2

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.

Wayne O'Donnell

Posted 2016-01-18T18:28:53.560

Reputation: 21

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

Photon001

Posted 2016-01-18T18:28:53.560

Reputation: 101

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. – Máté Juhász – 2016-01-21T14:18:48.270

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 – 2016-01-21T14:23:12.257