LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default using a calendar control

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calendar Control donwb Excel Discussion (Misc queries) 0 May 15th 09 08:31 AM
Control disappeared problem - specifically, the Calendar Control JMMach[_2_] Excel Programming 0 December 16th 05 01:53 AM
Calendar Control Ernst Guckel[_4_] Excel Programming 0 July 11th 05 02:00 AM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM
Calendar Control Kelly[_7_] Excel Programming 4 January 9th 04 10:05 PM


All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"