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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a Popup Calendar to a Userform

Status
Not open for further replies.

niknik24

Vendor
Feb 16, 2007
18
GB
Hello

I am trying to create a userform that will allow people to input data into an excel spreadsheet in a controlled way. I would like to include a date field and would like to have a popup calendar on my userform. is this possible?

Thanks

Nik
 
When you have your UserForm up, right-click on an empty are a in your Toolbox next to any control you can choose.

Click on Additional Controls...

You can add:
Calendar Control, or my favorite: Microsoft MonthView Control.

The chosen additional controlls will apear in your toolbox.

I usually use MonthView control when user clicks on a text box where date is expected.


Have fun.

---- Andy
 
Hi Andy - Thanks

I have the control but i can't seem to make it all work. Basically i want my user to be filling information in on my userform, then they clcik a comman button and a calender pops up which will populate a field on my userform1

does that make sense

Thanks
 
OK, I have a basic UserForm with TextBox1 and MonthView1 on it.
Code:
Option Explicit

Private Sub MonthView1_DateDblClick(ByVal DateDblClicked As Date)
    TextBox1.Text = MonthView1.Value
    MonthView1.Visible = False
End Sub

Private Sub TextBox1_Enter()
    MonthView1.Move TextBox1.Left, TextBox1.Top + TextBox1.Height
    MonthView1.Visible = True
End Sub

Private Sub UserForm_Activate()
    MonthView1.Visible = False
End Sub

That should get you started.

You may want to have another controls on the UserForm, like a command button, to be able to click on textbox to activate TextBox1_Enter event.


Have fun.

---- Andy
 
Thanks Taupirho - very useful - i've managed it now - always seems to take a while to sink in
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top