Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ll ll is offline
external usenet poster
 
Posts: 67
Default Calendar Control 11 - Month/Year Only

Hi,
I am working with a form in Excel, and I've been trying to get the
calendar control (11) to fire when only the month and year are
completed, but I cannot find a way.
Currently, I have this code behind the calendar (which comes up from a
button on the form):

=======
Private Sub calendar1_Click()

Calendar1.Day = 1

frmCourseBooking.txtDateTaken.Value = frmCal.Calendar1.Value

Unload frmCal
End Sub
==========
This does work, but it only will work one time: if the "parent" form is
left open and the calendar launch button is clicked again, the calendar
does come up, but the first day of the month isn't selected after the
first time. Basically, I'm just trying to get around having to select
the day by having it in the code. Any help is greatly appreciated.

Thanks,
Louis

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Calendar Control 11 - Month/Year Only


Hi

If I understand you correct?

Try this
Calendar1.Value = DateSerial(Year(Date), Month(Date), 1)


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ll" wrote in message ups.com...
Hi,
I am working with a form in Excel, and I've been trying to get the
calendar control (11) to fire when only the month and year are
completed, but I cannot find a way.
Currently, I have this code behind the calendar (which comes up from a
button on the form):

=======
Private Sub calendar1_Click()

Calendar1.Day = 1

frmCourseBooking.txtDateTaken.Value = frmCal.Calendar1.Value

Unload frmCal
End Sub
==========
This does work, but it only will work one time: if the "parent" form is
left open and the calendar launch button is clicked again, the calendar
does come up, but the first day of the month isn't selected after the
first time. Basically, I'm just trying to get around having to select
the day by having it in the code. Any help is greatly appreciated.

Thanks,
Louis



  #3   Report Post  
Posted to microsoft.public.excel.programming
ll ll is offline
external usenet poster
 
Posts: 67
Default Calendar Control 11 - Month/Year Only

Thanks,

I am really looking for a way to make the calendar only "need" the
month and year - without having to manually click on the day in order
to fire the script. I've tried doing an "on change" so that when the
month was changed, the date would automatically be placed in a box on
the form, but that didn't work.

I am trying to put the calendar into the form itself, rather than
having it on a secondary form. I have hidden the days, as they are not
needed. I have one submit button that submits a course name, category,
and (hopefully) the date to a spreadsheet from this form. The problem
is, the date will not populate the spreadsheet without having a click
event from the days - I wonder if my only option is to set up another
"OK" button next to the calendar selection in order to fire the date?

Thanks again

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Calendar Control 11 - Month/Year Only

You can use this maybe

Private Sub Calendar1_NewMonth()
End Sub

Private Sub Calendar1_NewYear()
End Sub

See also
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ll" wrote in message oups.com...
Thanks,

I am really looking for a way to make the calendar only "need" the
month and year - without having to manually click on the day in order
to fire the script. I've tried doing an "on change" so that when the
month was changed, the date would automatically be placed in a box on
the form, but that didn't work.

I am trying to put the calendar into the form itself, rather than
having it on a secondary form. I have hidden the days, as they are not
needed. I have one submit button that submits a course name, category,
and (hopefully) the date to a spreadsheet from this form. The problem
is, the date will not populate the spreadsheet without having a click
event from the days - I wonder if my only option is to set up another
"OK" button next to the calendar selection in order to fire the date?

Thanks again



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Calendar Control 11 - Month/Year Only

Btw: This are events of the control

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
You can use this maybe

Private Sub Calendar1_NewMonth()
End Sub

Private Sub Calendar1_NewYear()
End Sub

See also
http://www.rondebruin.nl/calendar.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ll" wrote in message oups.com...
Thanks,

I am really looking for a way to make the calendar only "need" the
month and year - without having to manually click on the day in order
to fire the script. I've tried doing an "on change" so that when the
month was changed, the date would automatically be placed in a box on
the form, but that didn't work.

I am trying to put the calendar into the form itself, rather than
having it on a secondary form. I have hidden the days, as they are not
needed. I have one submit button that submits a course name, category,
and (hopefully) the date to a spreadsheet from this form. The problem
is, the date will not populate the spreadsheet without having a click
event from the days - I wonder if my only option is to set up another
"OK" button next to the calendar selection in order to fire the date?

Thanks again







  #6   Report Post  
Posted to microsoft.public.excel.programming
ll ll is offline
external usenet poster
 
Posts: 67
Default Calendar Control 11 - Month/Year Only

Thanks Ron,
It works now, but it will only enter the date once - each subsequent
date or year change will put an empty value ("") into the cell. Is
there perhaps a trap for this? I've thought about using .clear, but
apparently it can't be used with the calendar.

In order to change the date again, I have to close and re-open the
form.

Thanks again

Reply
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
Tell me which "season" (Month/Day through Month/Day) a date(Month/Day/Year) falls in (any year)??? misscrf Excel Discussion (Misc queries) 1 December 14th 07 02:59 PM
Help dealing with a fiscal year rather than a calendar year Tyler Excel Worksheet Functions 3 August 25th 07 11:26 AM
Opening calendar form with today's month & year pkeegs Excel Discussion (Misc queries) 2 December 17th 06 07:53 PM
change the year in a calendar template to different year George Excel Discussion (Misc queries) 1 July 19th 06 07:34 PM
Need advice, help on creating Microsoft month calendar control using the winapi in Excel Johan De Schutter Excel Programming 0 November 22nd 04 10:10 AM


All times are GMT +1. The time now is 06:18 AM.

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"