PDA

View Full Version : Macro to set custom reminder times.



somoteitbe
12-06-2018, 01:42 PM
Let me preface with I am new to the possibilities of programming with VBA and the Office programs. That being said, once I realized what was possible, I got very excited. I am also new to the forum so please excuse any mistakes or breaks from protocol that I might make.

I want to run a macro using a keyboard shortcut that will set a custom reminder time. Start date, due date, and reminder time will all be the same. I also want to replicate the code to be able to set multiple reminder times. So, for example, I want to be able to choose a reminder time of 1 day, 2 days, 3 days, 5 days, 7 days, or 14 days. Preferably these would all be different macros with different shortcuts, so I would be able to choose when I want to be reminded based on importance. Thanks for any and all help!

skatonni
12-18-2018, 10:41 AM
Option Explicit

Private Sub Appt_With_Reminder()

' If you put this on the Quick Access Toolbar,
' the shortcut is:
'
' ALT + designated character(s)
'
' Click ALT and release to see the designated character(s)
'
' Use the numbers across the top of the keyboard not the keypad.

Dim objAppt As AppointmentItem

Set objAppt = CreateItem(olAppointmentItem)

objAppt.Subject = "Reminder test"

objAppt.Start = Now + (1 / 24) / 2 ' (1 day / 24 hours)/ 2 = one half hour from now
objAppt.End = Now + (1 / 24) ' (1 day / 24 hours) = one hour from now

objAppt.ReminderSet = True
objAppt.ReminderMinutesBeforeStart = 37 ' whole minutes

objAppt.Sensitivity = olPrivate
objAppt.Display

End Sub