![]() |
|
|
|
#1
|
|||
|
|||
|
Thank you Andrew,
Please excuse my lack of knowledge. I fixed the field tags but when I pasted the code below the existing code, I get the error message (see the attachment). And just for the record, the the first code was from another post that I created. this is the code 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
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Select Case ContentControl.Tag
Case "Rev. #"
If ContentControl.ShowingPlaceholderText Then
MsgBox "Rev. # requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED"
Cancel = True
End If
Case "PDR #"
If ContentControl.ShowingPlaceholderText Then
MsgBox "PDR # requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED"
Cancel = True
End If
Case "Date of Discovery"
If ContentControl.ShowingPlaceholderText Then
MsgBox "Date of Discovery requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED"
Cancel = True
End If
Case "Type"
If ContentControl.ShowingPlaceholderText Then
MsgBox "Type requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED"
Cancel = True
End If
Case "ManNum"
If Not IsNumeric(ContentControl.Range.Text) Then
MsgBox "This field requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED"
Cancel = True
End If
End Select
lbl_Exit:
Exit Sub
End Sub
Last edited by CellCharger; 07-27-2022 at 05:49 AM. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
how to make a template with field and mailmerge to work together in protected mode
|
pjkon | Mail Merge | 1 | 06-10-2019 04:35 PM |
| How To Make 2013 Populate To Field | abraxis | Outlook | 2 | 08-10-2018 06:41 AM |
How to make a Check Box Form Field red if not checked?
|
CarlCR | Word Tables | 3 | 07-12-2016 08:35 PM |
How to make a SEQ field show up in cross references?
|
Roscoe | Word | 5 | 06-01-2016 01:39 PM |
| make text form field active dependent on dropdown | Glenn0004 | Word VBA | 1 | 06-23-2015 06:13 PM |