Microsoft Office Tutorials and References
In Depth Information
Using Calendar Control for Office Applications
Else¶
MsgBox Me.Value¶
End If¶
End Sub¶
' * * * * *¶
Public Sub CloseForm()¶
'Close calendar¶
Unload Me¶
End Sub¶
Place the following code in a class module. Tools | Insert | Class Module from
the menu bar will insert a class module in the selected VBAProject. Rename
the class module using the name box in the Properties window (lower left) of
the VBE. The new name should be clsControls.
Option Explicit¶
' * * * * *¶
'Form control to handle day clicks¶
'These controls are created on the fly¶
Public WithEvents DayCell As MSForms.Label¶
' * * * * *¶
Private Sub DayCell_Click()¶
'Day is changed¶
'Call parent's related procedure to change¶
'the selected day¶
Call DayCell.Parent.Parent.ChangeDay(DayCell)¶
End Sub¶
' * * * * *¶
Private Sub DayCell_DblClick(ByVal Cancel As _¶
MSForms.ReturnBoolean)¶
'Double-click means select and quit calendar¶
'Call parent's related procedure to change¶
'the selected day and quit calendar¶
'If it is a day out of selected month range then¶
'it will not execute double-click since the month¶
'view will be changed and second click will be¶
'finalized on the new month view¶
Call DayCell.Parent.Parent.ChangeDay(DayCell)¶
Call DayCell.Parent.Parent.CloseForm¶
End Sub¶
Cmb
If you are using Excel, place the following code in the ThisWorkbook module.
Access this module by double-clicking the ThisWorkbook title in the Project
Explorer window (top left) or right-clicking the ThisWorkbook title and
selecting View Code from the drop-down menu. If you are using Word, see the
following page.
Search JabSto ::




Custom Search