
easy question on Input Masks
No, I don't believe there's a way to do that in Word. As I
said, it's definitely not like Access; the term 'input mask'
doesn't even occur in the Word
VBA helpfile ('97).
You could write a (very involved) procedure to check each
*keypress* in a textbox and reject, on the fly, those that
don't match the type and position required. I hate to think
of the work that would require, though -- esp. to give the
user the option of, say, typing or not typing the paren and
the dash. You'd use the KeyPress event instead of the Exit
event. You'd probably be really tired when you're done. ;)
Another possibility: Use 3 textboxes, one for each section
of the phone number. Put the parens and the dash outside
the boxes. Personally I hate forms like that, where I've
gotta tab between trivial parts of an item, but they're
quite common, and I'll bet the work needed to render it
Accesslike is the reason why.
--
Reply ONLY to the newsgroup. Note: MVPs do not work for Microsoft.
MVP FAQ: http://www.mvps.org/word
Userforms demystified: http://www.speakeasy.org/~mtangard/userforms.html
"Life is nothing if you're not obsessed." --John Waters
Quote:
> Thanks Mark, but this doesn't work AS the user is entering
> the data in the textbox correct?
> Is there a library or a refrence that I could add in that
> will supply the VB textboxes that do this?!
> Please let me know,
> Mike
> >-----Original Message-----
> >Hi Mike,
> >It's not as cool and built-in in Word as it is in Access,
> but it's
> >possible. Basically you want to use the "Like" operator
> in a macro
> >that validates the user's entry.
> >x = "(415) 555-1234"
> >If x Like "(###) ###-####" Then
> > ' Valid
> >Else
> > ' Invalid
> >End If
> >y = "X9R 7W1"
> >If y Like "[A-Z]#[A-Z] #[A-Z]#" Then
> > ' Valid
> >Else
> > ' Invalid
> >End If
> >Word MVP FAQ: http://www.mvps.org/word
> >Reply ONLY to the newsgroup. Note: MVPs do not work for
> Microsoft.
> >Userform demystification:
> http://www.speakeasy.org/~mtangard/userforms.html
> >"Life is nothing if you're not obsessed." --John Waters
> >> I can't seem to find a way to get an input mask on my
> >> textboxes for
> >> phone number: (999)333-3333 or
> >> postal code: X9X 9X9
> >> any help?
> >> Mike
> >.