For formfileds, you will have to create a custom procedure and call in when you exit the formfield (see the formfield properties dialog):
Private Sub FormatInput()
Dim oFF As FormField
Set oFF = ActiveDocument.FormFields("Text1") 'Your formfield bookmark name.
If Not oFF.Range.Text Like "####-###-####" Then
If IsNumeric(oFF.Range.Text) And Len(oFF.Range.Text) = 11 Then
oFF.Range.Text = Format(oFF.Range.Text, "####-###-####")
Else
MsgBox "Please enter an eleven digit ID"
End If
End If
End Sub
|