Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am confused about the calendar control. I used the tools\additional
controls menu to add calendar control 9.0 to my vba project. I am designing a userform, that has a combobox, where a date will be input. The default value of the combobox is set to todays date in the initialize event of the userform as follows: ComboBox1.Value = CDate(FormatDateTime(Now, vbShortDate)) on the dropButtonclick event of the combobox, i use the following code to bring up a second userform (calendar) which has a calendar control on it, and a cancel button: Private Sub ComboBox1_DropButtonClick() Calendar.Show End Sub so far so good. It works as i would expect. But... I want to transfer the selection from this calendar control back to the combobox. I am using this code: Private Sub Calendar1_Click() LogInNew.ComboBox1.Value = Calendar1.Value LogInNew.ListBox1.SetFocus Unload Me End Sub now this isn't perfect, because it isn't limited to selection clicks. ie if you click anywhere on the control, the calendar unloads. I can live with that. the bigger problem is that it only works about half the time. sometimes the value in combobox1 changes, and the focus is re-set to the next control, but sometimes combobox1 doesn't change, and the control is stuck sort of open. Is there some better way to do what i am trying to do? Is there a better event to use? also, another important consideration is, am i going to have problems distributing this spreadsheet, which i am designing as a template for many users in my office? any help would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calendar Control | Excel Discussion (Misc queries) | |||
Control disappeared problem - specifically, the Calendar Control | Excel Programming | |||
Calendar Control | Excel Programming | |||
Calendar Control: Can't exit design mode because control can't be created | Excel Programming | |||
Calendar Control | Excel Programming |