![]() |
#6
|
||||
|
||||
![]()
As alluded to in my assumption, you can't have two instances of the same macro names in the same module. Try replacing the code you have with this single macro which merges the intent of both macros with a bit more flexibility. Note that there is a difference between the Tag and Title properties on a Content Control. Either can be used in the code.
Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean) If aCC.ShowingPlaceholderText Then Select Case aCC.Tag Case "Rev. #", "PDR #", "Date of Discovery", "Type" 'these CCs require an answer MsgBox "This Content Control requires a response.", vbInformation + vbOKOnly, "INPUT REQUIRED" Cancel = True End Select Else 'if CC has content, check its type matches the content If aCC.Tag Like "*[#]" Then 'if the CCs tag ends with '#' If Not IsNumeric(aCC.Range.Text) Then MsgBox "This field requires a numeric response.", vbInformation + vbOKOnly, "INPUT REQUIRED" Cancel = True End If ElseIf aCC.Tag Like "*Date*" Then 'if CCs tag includes 'Date' If Not IsDate(aCC.Range.Text) Then MsgBox "This field requires a date response.", vbInformation + vbOKOnly, "INPUT REQUIRED" Cancel = True End If End If End If End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
CarlCR | Word Tables | 3 | 07-12-2016 08:35 PM |
![]() |
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 |