Excel - Format a Userform Textbox Properties

Asked By JoJo on 18-Oct-07 11:13 AM
How do I set the properties of a textbox in a suerform to accept a date only?




Rick Rothstein \(MVP - VB\) replied on 18-Oct-07 11:38 AM
Instead of using a TextBox, why not consider using a Microsoft Date and Time
Picker control. It is a combo box like control with a text area pre-filled
in with a date whose month, day and year fields can be visited and changed
via the arrow keys or by typing in value for each of them. In addition,
clicking the down arrow pops up a calendar's month view where your user can
pick the date from.

To add one to your UserForm's Toolbox, right click a blank area of the
UserForm's Toolbox and select "Additional Controls" from the popup menu that
appears. Scroll down until you find an item that says "Microsoft Date and
Time Picker Control" and place a checkmark next to it; then hit OK. Now,
select the DTPicker (what the control is called in its ToolTip) control that
was added to the Toolbox and place it on the UserForm. The size of the month
display is controlled by the Font Size used.

Rick