Private Sub TimeCheck() Dim TimeDifference As String 'dim TimeNow as ? Dim TaskTime As String Dim dteTaskTime As Date ' I assume that this is defined someplace else so it's ' not needed here Dim gintDailyReminder As Integer ' I assume that TaskTime is the time at which she needs ' to take her medicine TaskTime = 900 '9AM dteTaskTime = Left$(TaskTime, Len(TaskTime) - 2) & ":" & Right$(TaskTime, 2) ' I assume that gintDailyReminder is the number of hours before ' the task time that she should get the first message gintDailyReminder = 2 'from ini file(Hours) ' What is megintDailyReminder? Did you mean gintDailyReminder? 'TaskTime = TaskTime - megintDailyReminder TimeDifference = Format(Time() - dteTaskTime, "HH:NN") 'gintDailyReminder Select Case CInt(Left$(TimeDifference, 2)) - gintDailyReminder Case Is > 2 Exit Sub Case 0 MsgBox "You need to take your medicine in 2 hours at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/PM Case -1 MsgBox "You need to take your medicine in 1 hour at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/PM Case Else MsgBox "You Forgot to take your medicine at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/P End Select End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.