![]() |
|
|
|
#1
|
||||
|
||||
|
OK. Add the following to the ThisDocument module of the document
Code:
Option Explicit
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
If ContentControl.Title = "Issue Date" Then
If Not ContentControl.Range.Text = ContentControl.PlaceholderText Then
ActiveDocument.SelectContentControlsByTitle("Expiry Date").Item(1).Range.Text = _
DateAdd("m", 12, CDate(ContentControl.Range.Text))
End If
End If
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#2
|
|||
|
|||
|
I went into the document I sent you and clicked on the macros button. There was a Macros1 on the list. I clicked edit and inserted the code you provided and exited the Visual Basic. I then saved the document as a Macro Enabled Template. I then clicked on the template and chose the date on issue date, but the expiry date did not change.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to change logo /dates in numerous word documents without changing each one individually?
|
newi1 | Word VBA | 3 | 04-22-2016 07:02 PM |
| Autofill dates - how can I get the same date and consecutive dates? | Exhale | Excel | 3 | 04-05-2016 03:11 AM |
Linking dates in Headers and Footers
|
lenoble22 | Word | 1 | 01-16-2014 12:20 PM |
| How to change dates automatically | PaperBuster | Word | 5 | 09-24-2012 09:31 PM |
| How to change number format of dates | ketanco | Project | 1 | 09-11-2012 02:34 PM |