View Single Post
 
Old 07-24-2015, 02:31 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following macros will add a reminder and an appointment at the same time. You can choose how many days to add (to today) to place the appointment and reminder. Put the macros in the same (new) module, select a message and run the macro 'RemindMsg'. You can add this macro to the ribbon for ease of access.

You may need to use SelfCert.exe to sign the macro.

Code:
Option Explicit

Sub RemindMsg()
Dim olMsg As MailItem
    On Error GoTo err_handler
    Set olMsg = ActiveExplorer.Selection.Item(1)
    FlagMessage olMsg
lbl_Exit:
    Exit Sub
err_handler:
    MsgBox Err.Number & vbCr & Err.Description & vbCr & vbCr & _
           "Ensure you have a message selected before running the test macro!"
    GoTo lbl_Exit
End Sub

Public Sub FlagMessage(olItem As Outlook.MailItem)
Dim strTime As String
Dim strDays As String
    strDays = InputBox("Remind in how many days?")
    If strDays = "" Then strDays = 1
    strTime = Now + Val(strDays)
    With olItem
        AddAppt .Subject & " - " & .SenderEmailAddress, strTime
        .MarkAsTask olMarkThisWeek
        .ReminderSet = True
        .ReminderTime = strTime
        .Save
    End With
lbl_Exit:
    Exit Sub
End Sub

Public Sub AddAppt(strSubject As String, strTime As String)
Dim objApt As AppointmentItem
    Set objApt = Application.CreateItem(olAppointmentItem)
    With objApt
        .ReminderSet = False
        .Subject = strSubject
        .Start = strTime
        .AllDayEvent = True
        .Save
    End With
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote