![]() |
|
#1
|
|||
|
|||
![]()
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 Last edited by macropod; 12-21-2020 at 02:16 PM. Reason: Added code tags |
#2
|
|||
|
|||
![]()
Sorry I didn't specify, I thought I specified which text form field I used.
I am using the legacy text field set to Regular text with max length to 11 from the code you provided, that made sense to me, but is there a keyword to change "ContentControl" to legacy text field instead? Thank You |
![]() |
Tags |
autoformat, formating |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
aditya_bokade | Word VBA | 28 | 11-13-2021 10:48 PM |
![]() |
Esgrimidor | Word VBA | 7 | 03-16-2017 01:02 PM |
![]() |
Jow | Word VBA | 4 | 09-15-2016 04:06 AM |
![]() |
Stacy | Excel | 2 | 09-12-2014 07:03 AM |
Macro to insert WordArt characters | Jennifer Murphy | Word VBA | 1 | 02-25-2014 03:10 AM |