ShowDatePicker

<< Click to Display Table of Contents >>

 

ShowDatePicker

ShowDatePicker(DateValue, [Left], [Top], [DefaultDate])

Opens a dialog box to change date and time. This method returns True if users confirm a date or False if users cancel editing. A new date is returned in the DateValue parameter. Dialog box's position can be configured using the optional Left and Top parameters, which indicate the distance from Screen's left margin and top in pixels, respectively. In case these parameters are not informed, this dialog box is centered on the screen. The value of the optional DefaultDate parameter is the initial date and time when this dialog box was opened. If no date is informed, assumes the current date. If no time is informed, it starts as "00:00:00". If no date nor time are informed, it starts with the current date and time. Example:

Sub Text2_Click()
  Dim newTime
  Application.ShowDatePicker newTime, 300, 300
  MsgBox "The time is : " & newTime
End Sub

Was this page useful?