A family of Microsoft word processing software products for creating web, email, and print documents.
For what you want to do, you don't need a DatePicker.
For a plain date, all you need is a plain text content control. For example, with a content control titled 'USDate' and US date format:
Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl)
Application.ScreenUpdating = False
Dim Rng As Range
With CCtrl
If .Title <> "USDate" Then Exit Sub
.Range.Text = Format(Now + 90, "MMM d, YYYY")
End With
Application.ScreenUpdating = True
End Sub
For a superscripted Ordinal date, you could use a rich text content control with:
Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl)
Application.ScreenUpdating = False
Dim Rng As Range
With CCtrl
If .Title <> "USDate" Then Exit Sub
.Range.Text = Format(Now + 90, "MMM d, YYYY")
Set Rng = .Range.Words(2): Rng.Text = Ordinal(Rng.Text): Rng.Start = Rng.End - 2: Rng.Font.Superscript = True
End With
Application.ScreenUpdating = True
End Sub
Function Ordinal(Val As Integer) As String
Dim strOrd As String
If (Val Mod 100) < 11 Or (Val Mod 100) > 13 Then strOrd = Choose(Val Mod 10, "st", "nd", "rd") & ""
Ordinal = Val & IIf(strOrd = "", "th", strOrd)
End Function
The content control will update immediately you enter it.
Similarly, if you have two Rich Text content controls, titled 'Date1' & 'Date2', a macro like:
Private Sub Document_ContentControlOnEnter(ByVal CCtrl As ContentControl)
Application.ScreenUpdating = False
Dim Rng As Range
With CCtrl
If .Title <> "Date1" Then Exit Sub
.Range.Text = Format(Now, "MMM d, YYYY")
Set Rng = .Range.Words(2): Rng.Text = Ordinal(Rng.Text): Rng.Start = Rng.End - 2: Rng.Font.Superscript = True
With ActiveDocument.SelectContentControlsByTitle("Date2")(1)
.Range.Text = Format(Now + 90, "MMM d, YYYY")
Set Rng = .Range.Words(2): Rng.Text = Ordinal(Rng.Text): Rng.Start = Rng.End - 2: Rng.Font.Superscript = True
End With
End With
Application.ScreenUpdating = True
End Sub
Function Ordinal(Val As Integer) As String
Dim strOrd As String
If (Val Mod 100) < 11 Or (Val Mod 100) > 13 Then strOrd = Choose(Val Mod 10, "st", "nd", "rd") & ""
Ordinal = Val & IIf(strOrd = "", "th", strOrd)
End Function
will update both immediately you enter the 'Date1' content control - 'Date1' with today's date and 'Date2' with today's date +90.