Microsoft Office Tutorials and References
In Depth Information
Using Calendar Control for Office Applications
'Start from the previous month¶
'Show disabled the previos month's days¶
For i = disEnd - disStart To 0 Step -1¶
With .fraBack.Controls("day" & Trim(i))¶
.ForeColor = cVarDisForeColor¶
.Caption = Day(disEnd - (disEnd - disStart - i))¶
.Tag = disEnd - (disEnd - disStart - i)¶
End With¶
Next i¶
'Show selected month's days¶
'i variable is the long value of the¶
'related day¶
For i = selStart To selEnd¶
With .fraBack.Controls("day" & _¶
Trim(Weekday(selStart) - 1 + i - selStart))¶
.Caption = Day(i)¶
'Store this day's long value in Tag property¶
'to know which day is assigned for this control¶
.Tag = i¶
'If i meets the selected date of calendar¶
'then set back and fore colors of this control¶
If i = cvarValue Then¶
If i = Date Then¶
'If selected date is today, then use special colors¶
'assigned for Today¶
.BackColor = cVarSelBackToday¶
.ForeColor = cVarSelForeToday¶
'Use selected day colors¶
.BackColor = cVarSelBackColor¶
.ForeColor = cVarSelForeColor¶
End If¶
End If¶
End With¶
Next i¶
'Continue with next month¶
'Show disabled the next month's days¶
For i = Weekday(selStart) + selEnd - selStart To 41¶
j = j + 1¶
With .fraBack.Controls("day" & Trim(i))¶
.ForeColor = cVarDisForeColor¶
.Caption = j¶
.Tag = CLng(DateSerial(cVarCYear, cVarCMonth + 1, j))¶
End With¶
Next i¶
'Set selected month value in drop-down control¶
.cmbMonth.ListIndex = cVarCMonth - 1¶
'Set spin button value as selected year¶
.spnYear.Value = Year(cvarValue)¶
Search JabSto ::

Custom Search