Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Mask in XL Userform??

Status
Not open for further replies.

VulcanJedi

Technical User
Oct 2, 2002
430
US
Is there a way to implement an input mask in an XL Userform? I want ensure date format in textbox? [yinyang] Tranpkp [pc2]
 
You can do just about anything in the _change event handler for the textbox. Alternatively, you could look into the calendar/datepicker controls.
Rob
[flowerface]
 
I got the calendar thing, but sometimes it is just easier to type in.... [yinyang] Tranpkp [pc2]
 
How do you want to configure the input mask? Just a check when the user is done, or hand-holding as the user is typing?
Rob
[flowerface]
 
I guess the latter like in MS Access, but just a dream I suppose. I already wrote a ton of preventative code. [yinyang] Tranpkp [pc2]
 
It certainly can be done, with some effort. You just have to be very specific about the requirements, and implement rigorously. For example, it's easy to deal with new characters as they are typed, but you also need to correctly handle the user backspacing, or even selecting a portion of text in the middle of the textbox and replacing it with a keystroke.

Rob
[flowerface]
 
I REFUSE to implement all that, ugh...isn't there a simple solution? Anybody? I feel bad I've exhausted this much of Rob's time already, and I refuse to do all that code for people to be lazy. So unless there's a much simpler solution, Calendar it is. [yinyang] Tranpkp [pc2]
 
The calendar control can be cumbersome, but I think the DTPicker control may be more what you're looking for (it's in Microsoft Common Controls). You can choose to just type your date, or pick from a calendar by hitting the dropdown arrow.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top