Give this a try
Sub CreateAppt()
On Error GoTo erHandle
Dim olApp As Object
Dim olItem As Object
Dim dt As Date
Dim dk As String
Dim Msg As String, Ans As Variant
Msg = "Do you want to set an appointment reminder?"
Ans = MsgBox(Msg, vbYesNo)
Select Case Ans
Case vbYes
dt = Cells(Selection.Row, "G").Value 'Range("S1").Value
dk = Cells(Selection.Row, "F").Value & "-" & Cells(Selection.Row, "H").Value 'Range("S2").Value
Set olApp = CreateObject("Outlook.Application")
Set olItem = olApp.CreateItem(1)
With olItem
.Subject = Range("S3") 'Change to cell that has value for subject
.Location = "Log"
.Body = Format("#" & dk) ' & Range("S1")
'.Body = Format("#" & dk & " is the docket number to research")
.ReminderMinutesBeforeStart = 0.5 * 60 '1 hours times 60 minutes
.Start = Format(dt + 8.5 / 24, "mm/dd/yyyy hh:mm")
.End = Format(dt + 9 / 24, "mm/dd/yyyy hh:mm")
.AllDayEvent = False
.Save
End With
Exit Sub
erHandle:
If Err.Number = 13 Then
MsgBox "Active cell must containt a date", vbCritical
Else
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description
End If
Case vbNo
GoTo Quit:
End Select
Quit:
End Sub
Bookmarks