Microsoft Office Tutorials and References
In Depth Information
Using Calendar Control for Office Applications
'Change caption of UserForm to show the selected day¶
.Caption = Format(cvarValue, "mmmm dd, yyyy")¶
End With¶
End Sub¶
' * * * * *¶
Private Sub MarkDate(DayCell As MSForms.Label)¶
'If day is changing but month is not¶
'then this procedure will simply mark the¶
'selected day on UserForm¶
'No need to change month or year controls¶
'and also no need to change month view since¶
'same month is still needed¶
Dim cnt As MSForms.Label¶
With Me¶
'Set day back and fore colors as default to not selected¶
For Each cnt In .fraBack.Controls¶
If cnt.Tag <> "caption" Then¶
If cnt.BackColor <> cVarDayBackColor Then¶
cnt.BackColor = cVarDayBackColor¶
cnt.ForeColor = cVarDayForeColor¶
End If¶
End If¶
Next cnt¶
'Set selected days (Value) back and fore color¶
If cvarValue = Date Then¶
'If selected date is today, then use special colors¶
'assigned for Today¶
DayCell.BackColor = cVarSelBackToday¶
DayCell.ForeColor = cVarSelForeToday¶
Else¶
'Use selected day colors¶
DayCell.BackColor = cVarSelBackColor¶
DayCell.ForeColor = cVarSelForeColor¶
End If¶
'Change caption of UserForm to show the selected day¶
.Caption = Format(cvarValue, "mmmm dd, yyyy")¶
End With¶
End Sub¶
' * * * * *¶
Private Sub cmbMonth_Click()¶
'This is the event that is triggered by¶
'changing the month drop-down control¶
With Me¶
'If the selected day is in the range of the newly¶
'selected month then there is no problem¶
'However if selected day is 31 and the next month¶
'has only 30 days then this should be handled¶
If Month(DateSerial(cVarCYear, .cmbMonth.ListIndex + 1, _¶
cVarCDay)) <> .cmbMonth.ListIndex + 1 Then¶
Cmb
Search JabSto ::




Custom Search