Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Textbox Format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gti_jobert - 19 Jan 2006 14:20 GMT
Hi all,

I have a textbox on my userform and neeeeed it formatted. When the user
enters it I want them to enter a 10 digit number only but also have it
display a '-' in the middle of the number.

for example,

#####-##### (the textbox should always display the '-' in the middle of
the textbox. Is this possible? I have previously tried:

Code:
--------------------
   txtPartno.Text = Format(txtPartno.Text, "#####-#####")
--------------------

but have had no joy, any help would be much appreciated.

Taa in advance!

Signature

gti_jobert

Ian - 19 Jan 2006 14:45 GMT
Possibly not the most elegant method, but this will put a - immediately
after the 5th character in TextBox1

Private Sub TextBox1_Change()
If Len(TextBox1.Text) = 5 Then TextBox1.Text = TextBox1.Text & "-"
End Sub

Signature

Ian
--

>
> Hi all,
[quoted text clipped - 16 lines]
>
> Taa in advance!
gti_jobert - 19 Jan 2006 15:11 GMT
Hi again,

Thanks for the promt reply! I have tried what you have suggested and
works quite well. I'm not sure if it can be done in VBA, but is there a
way of using an activex control to mask the textbox? I may have seen
somewhere on the web that it can be done in VB6?!

Does anyone know how to do it in VBA?

Thanks Again!

Signature

gti_jobert

Ian - 19 Jan 2006 16:19 GMT
I'm confused by your response as my suggestion IS in VBA.

Signature

Ian
--

>
> Hi again,
[quoted text clipped - 7 lines]
>
> Thanks Again!
Dave Peterson - 19 Jan 2006 18:07 GMT
gti_jobert wanted to know if he/she can mask the textbox so that the format can
be "built-in".

Excel's textboxes don't support this.

> I'm confused by your response as my suggestion IS in VBA.
>
[quoted text clipped - 19 lines]
> > http://www.excelforum.com/member.php?action=getinfo&userid=30634
> > View this thread: http://www.excelforum.com/showthread.php?threadid=502886

Signature

Dave Peterson

Ian - 19 Jan 2006 20:09 GMT
Sorry, I didn't read the post properly.

Signature

Ian
--

> gti_jobert wanted to know if he/she can mask the textbox so that the
> format can
[quoted text clipped - 29 lines]
>> > View this thread:
>> > http://www.excelforum.com/showthread.php?threadid=502886
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.