title: Excel VBA - How to format a UserForm TextBox in Time Format
body: <p>I am making a UserForm in excel that will create an appointment in my Outlook Calendar. Everything is working except the start and end times. Below is my code where DTPicker1 is the Date of the appointment and DTPicker2 and DTPicker3 are the start and end times respectively. They are in dtpTime format. The appointment is created on the right date and subject and everything works correctly except the times. Not sure what I'm supposed to do to fix it. Any help is appreciated. Thanks!</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim olApp As Outlook.Application
  Dim olAppItem As Outlook.AppointmentItem
  Dim r As Long
  
  On Error Resume Next
  Worksheets("Sheet1").Activate
  
  Set olApp = GetObject("", "Outlook.Application")
  On Error GoTo 0
  If olApp Is Nothing Then
      On Error Resume Next
      Set olApp = CreateObject("Outlook.Application")
      On Error GoTo 0
      If olApp Is Nothing Then
          MsgBox "Outlook is not available!"
          Exit Sub
      End If
  End If
  
  Dim mysub, myStart, myEnd
      mysub = TextBox1
      myStart = DTPicker1 &amp; DatePicker2
      myEnd = DTPicker1 &amp; DatePicker3
      Set olAppItem = olApp.CreateItem(olAppointmentItem) 'creates a new appointment
      With olAppItem
          'set default appointment values
          .Location = ""
          .Body = ""
          .ReminderSet = True
          .BusyStatus = olFree
          .RequiredAttendees = ""
          On Error Resume Next
          .Start = myStart
          .End = myEnd
          .Subject = TextBox1
          .Attachments.Add ("c:\temp\somefile.msg")
          .Location = ""
          .Body = ""
          .ReminderSet = True
          .BusyStatus = olBusy
          .Categories = "Orange Category" 
          On Error GoTo 0
          .Save 'saves the new appointment to the default folder
      End With
  Set olAppItem = Nothing
  Set olApp = Nothing
  MsgBox "Done !"
  End Sub
  </code></pre>