Jay
Wed Dec 08 14:44:15 CST 2004
rob p wrote:
> I am making a template in Word 2000. I am using text form fields. I
> need further formatting for two types of form fields than it seems I
> can get thru the form field options.
>
> One, I want a number mask like a SSN. ###-##-####. Enter nine numbers
> and it adds the dashes.
>
> Two, using regular text, I want one character to be entered, only
> selecting from the characters A,B, or C. Anything else won't work.
>
> Is there any way to set this up?
> Thanks.
Hi Rob,
You can do it with macros or with a Userform (custom dialog built in VBA)
but not with form fields alone.
One way is to write a macro that inserts the dashes in the SSN field (or
displays an error message if the field doesn't contain exactly 9 digits),
and set that as the field's exit macro. Similarly, you could write an exit
macro for the other field that complains if the field content isn't A, B, or
C. See
http://word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm.
The second field could be replaced with a dropdown that allows only a choice
of the three items.
Or you could create a Userform that contains controls for both entries, with
code behind it to validate and format the user's entry. This is slicker but
a bit more work. See
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org