Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Calendar in Excel Form (using mscal.ocx)

  Asked By: Jeff    Date: Jan 25    Category: MS Office    Views: 3580
  

I am using a calendar in a vba form in Excel (the mscal.ocx activex
control). My goal is to set the calendar up so that only a change in
the the month and year drop down boxes are required in order for the
date to be transferred to its text box on the form. I have made it
work; however, if I try to change the date again from the calendar,
the text box goes blank and will not re-populate with the calendar
date unless I either expand the calendar back out and click on one of
the date buttons, or if I close the form and then re-open it.

Does anyone here have experience with this type of thing?


Here's the code I'm using:
=============


Private Sub Calendar1_NewMonth()
Calendar1_Click
End Sub

Private Sub Calendar1_NewYear()
Calendar1_Click
End Sub

Private Sub Calendar1_Click()
Calendar1.Day = 1
frmCourseBooking.txtDateTaken.Value = frmCourseBooking.Calendar1.Value
End Sub

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Wanda Patterson     Answered On: Jan 25

Follow these steps in creating a calendar  or download the calendar from this
website.
http://www.fontstuff.com/vba/vbatut07.htm

 
Answer #2    Answered By: Joel Brown     Answered On: Jan 25

I had seen this page earlier,
but it did not answer my main question. That was: "how can I get the
calendar to update the date  more than once in a session?" I have
managed to make the calendar  update the date text  box whenever either
the month  or year  are changed, but if I try to do that a second time
without first closing the form  and then re-opening it, all I get is a
blank text box.
If I revert to using days as well, and clicking on the day  buttons,
then it works as it should; however, I only wish to select month and
year, and then have the date entered.

 
Didn't find what you were looking for? Find more on Calendar in Excel Form (using mscal.ocx) Or get search suggestion and latest updates.




Tagged: