![]() |
#3
|
|||
|
|||
![]()
Thank you Graham for your response.
This is the existing macro. It adds 30 days in the due date field . I am not sure but it looks it it disappeared when I saved the file as DOCX. Code:
Option Explicit 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 <> "Date of Initiation" Then Exit Sub If .ShowingPlaceholderText = True Then ActiveDocument.SelectContentControlsByTitle("Due Date")(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("Due Date")(1).Range.Text = Format(Dt + 30, .DateDisplayFormat) End If End With Application.ScreenUpdating = True End Sub Last edited by CellCharger; 11-02-2022 at 09:36 AM. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Text based on selection of dropdown list | cloud67 | Word VBA | 2 | 08-09-2019 06:46 AM |
Reveal portion of document based on dropdown selection | chappeja | Word VBA | 1 | 03-27-2019 08:36 PM |
![]() |
Alfred | Mail Merge | 2 | 05-23-2017 10:59 PM |
text based on Combo box selection | rosscortb | Word VBA | 3 | 03-16-2015 06:57 PM |
Inserting a particular image based on a combobox selection | LeonieD | PowerPoint | 2 | 06-27-2014 05:39 PM |