View Single Post
 
Old 12-21-2020, 01:27 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,600
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

That would depend on what type of field. If it is a content control in the document itself then something like this

Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
  Select Case ContentControl.Title
    Case "ID"
      If Not ContentControl.Range.Text Like "####-###-####" Then
        If IsNumeric(ContentControl.Range.Text) And Len(ContentControl.Range.Text) = 11 Then
           ContentControl.Range.Text = Format(ContentControl.Range.Text, "####-###-####")
        Else
          MsgBox "Please enter an eleven digit ID"
       End If
     End If
  End Select
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by macropod; 12-21-2020 at 02:16 PM. Reason: Added code tags
Reply With Quote