easy question on Input Masks 
Author Message
 easy question on Input Masks

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


Sun, 27 Mar 2005 02:04:59 GMT  
 easy question on Input Masks
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

Quote:

> 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



Sun, 27 Mar 2005 08:29:48 GMT  
 easy question on Input Masks
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

Quote:
>-----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

- Show quoted text -

Quote:
>"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
>.



Sun, 27 Mar 2005 23:59:38 GMT  
 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
> >.



Mon, 28 Mar 2005 00:51:30 GMT  
 easy question on Input Masks

Quote:
> No, I don't believe there's a way to do that in Word.

I hope the new XDocs-editor will make such validation easy:
http://www.microsoft.com/office/xdocs/default.asp

Though I have my doubts whether they will include custom-defined data
types. Till now, there is only some marketing blurb available, and next to
no hard information.

Especially the formatting toolbar in the picture to the above article (even
including bullets and numbering) makes me very suspicious. I might expect
such a toolbar in the forms editor, but not in the user interface.

Regards,
Klaus



Tue, 29 Mar 2005 03:16:06 GMT  
 easy question on Input Masks
Thanx guys...
Who knew that what I thought was an easy question would
turn out to be almost solutionless! Access makes it so
easy!  It just seems a little funny to me that they
wouldn't include that capability.
thanx again,
Mike

Quote:
>-----Original Message-----
>> No, I don't believe there's a way to do that in Word.

>I hope the new XDocs-editor will make such validation
easy:
>http://www.microsoft.com/office/xdocs/default.asp

>Though I have my doubts whether they will include custom-
defined data
>types. Till now, there is only some marketing blurb

available, and next to
Quote:
>no hard information.

>Especially the formatting toolbar in the picture to the
above article (even
>including bullets and numbering) makes me very

suspicious. I might expect
Quote:
>such a toolbar in the forms editor, but not in the user
interface.

>Regards,
>Klaus

>.



Tue, 29 Mar 2005 04:13:54 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. What I hope is any easy question about Input Masks

2. Question - Input Masks on Forms and Tables

3. input box - easy question

4. EASY EASY EASY question

5. help easy easy question

6. easy filecopy question...but maybe not so easy

7. Input Mask error

8. Add input mask to INPUTBOX function

9. Email Input Mask

10. Masking a Input Box

11. Input Mask

12. input mask

 

 
Powered by phpBB® Forum Software