![]() |
|
#4
|
|||
|
|||
|
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 |
| Tags |
| autoformat, formating |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to insert paragraph character after every 500 characters?
|
aditya_bokade | Word VBA | 28 | 11-13-2021 10:48 PM |
Insert text longer 254 characters in word
|
Esgrimidor | Word VBA | 7 | 03-16-2017 01:02 PM |
Insert more than 500 characters on FormField Word by VBA
|
Jow | Word VBA | 4 | 09-15-2016 04:06 AM |
Is there a quick way to remove the dashes and parentheses from phone numbers?
|
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 |