![]() |
|
#6
|
||||
|
||||
|
Assuming you're using a date-picker content control, you could use a ContentControlOnExit macro in the 'ThisDocument' module of the document or its template, coded as:
Code:
Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim Dt As Date, StrDt As String
With CCtrl
If .Title <> "StartDate" Then Exit Sub
If .ShowingPlaceholderText = True Then
ActiveDocument.SelectContentControlsByTitle("OffsetDate")(1).Range.Text = ""
Else
StrDt = .Range.Text
If IsDate(StrDt) Then
Dt = CDate(StrDt)
Else
Dt = CDate(Split(StrDt, (Split(StrDt, " ")(0)))(1))
End If
ActiveDocument.SelectContentControlsByTitle("OffsetDate")(1).Range.Text = Format(Dt + 30, .DateDisplayFormat)
End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| If date is Current Month 1 or within 30 days | Sje | Excel | 3 | 09-30-2019 10:40 PM |
Create a calendar based on shifts not days
|
lwlewis367 | Project | 1 | 11-04-2016 09:59 AM |
Date field - future date calculation + only business days
|
neon4 | Word | 7 | 01-21-2016 02:21 PM |
adding days to a date
|
euterpia | Excel | 1 | 01-18-2016 07:42 AM |
Date Field to add 10 Days to Current Date
|
Erbwon | Word | 6 | 11-12-2012 06:17 PM |