Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Calendar Control & ActiveControl
Hi,
I have a form with a number of text boxes that require a date value. I want to use a calendar control form to update each of these text boxes. My problem is I don't know how to efficiently reference the text boxes to the calendar control. At the moment I am trying to use the ActiveControl method in the form code as below: Private Sub UserForm_Initialize() ' Check if control with focus contains a date. If 'yes' show ' same date on calendar. If 'no' show today's date. If IsDate(UserForm2.ActiveControl.Value) Then Calendar1.Value = DateValue(UserForm2.ActiveControl.Value) Else Calendar1.Value = Date End If End Sub Private Sub Calendar1_Click() ' Transfer date selected on calendar to control with focus UserForm2.ActiveControl.Value = Calendar1.Value frmCalendar.Unload End Sub The the calendar is is triggered using the enter method for each textbox selected. e.g. Private Sub txReviewDate_Enter() frmCalendar.Show End Sub I think the problem may be to do with using the enter event with the ActiveControl method as the textbox will not yet have focus. Any help appreciated. Thanks, Marcus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveControl problem | Excel Discussion (Misc queries) | |||
Control disappeared problem - specifically, the Calendar Control | Excel Programming | |||
Calendar Control 9 | Excel Programming | |||
Calendar Control: Can't exit design mode because control can't be created | Excel Programming | |||
userform1.activecontrol.name | Excel Programming |