Results 1 to 3 of 3
  1. #1
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Formating a Textbox on a UserForm (97 and >)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> Loungers

    Is it possible to format a textbox on a userform?

    What I want to do is mimic the mask function in MS-Access, where you can type some numbers, say a US telephone number, and have it be displayed in the format (###) ###-####?

    I know that I can use the Special Format of the cell, but then that will involve dumping the value of the textbox into a cell and then calling it back and that returns a string with the () and the - in it already.

    The mask is only for display and the data stored is exactly what the user enters.

    I hope this is clear enough.

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Formating a Textbox on a UserForm (97 and >)

    Wassim,

    You could experiment with

    TextBox1 = Format(TextBox1, "(###) ###-####"), perhaps changing the #'s to zero.

    You need to choose which textbox event to included the above in, depending on the exact effect you are after,

    Andrew C

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Formating a Textbox on a UserForm (97 and >)

    The attached example has a userform where the phone number is formatted and displayed correctly as the user enters the digits.
    Attached Files Attached Files
    - Ricky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •