Outlook 2003 Calendar to E-mail using Macro

Posted on 2009-04-30
Last Modified: 2012-06-21
Is there a way to write a macro in outlook that's like a rule that will automatically send an e-mail when a meeting is 24 hours away? For instance, I have a meeting on my calendar and I need to be notified 24 hours before hand, but i'm unable to check my calendar. I'd like an e-mail forwared from my computer(which is left on with outlook running) that says something like , "you have "meeting name" in 24 hours."
Question by:Darkejo1
    LVL 76

    Expert Comment

    by:David Lee
    Hi, Darkejo1.

    Yes, that's possible.  I can do it in a couple of ways.  The simplest way will require you to set a reminder 24 hours out.  Will that work?  If not, then I can use a timer to check once an hour, it just means more and therefore the possibility of more problems.

    Author Comment

    Sure, thatll work. Anyway that's easier for you! If possible. Can you explain it at all? I'm kind of interested in learning it a little.
    LVL 76

    Accepted Solution

    Here's the code for doing this.  Follow these instructions to use it.

    1.  Start Outlook
    2.  Click Tools > Macro > Visual Basic Editor
    3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
    4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
    5.  Outlook's VB Editor window
    6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
    7.  Click the diskette icon on the toolbar to save the changes
    8.  Close the VB Editor
    9.  Click Tools > Macro > Security
    10. Set the Security Level to Medium
    11. Close Outlook
    12. Start Outlook
    13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

    Because this code sends a message it is going to trigger Outlook's built-in security.  The result is a popup dialog-box warning that an application is sending a message and asking for your permission to allow it to continue.  Outlook security cannot be disabled, but there are ways to work around it.  Here are the options.

    1.  Sign the code.  Here's a link to instructions on doing that:
    2.  Use ClickYes (, a small utility that'll click the Yes button for you.  It creates a security hole though, since a virus could start sending messages and ClickYes would click the Yes button for it too.  
    3.  Use Redemption (, a COM library that enables code to safely bypass Outlook security.

    This works by watching for an appointment's reminder.  When the code sees a reminder it checks to see if the source item is an appointment.  If it is, then it sends a message to you.
    Dim WithEvents olkReminders As Outlook.Reminders
    Private Sub Application_Quit()
        Set olkReminders = Nothing
    End Sub
    Private Sub Application_Startup()
        Set olkReminders = Outlook.Application.Reminders
    End Sub
    Private Sub olkReminders_ReminderFire(ByVal ReminderObject As Reminder)
        Dim olkAppt As Outlook.AppointmentItem, olkMsg As Outlook.MailItem
        If ReminderObject.Item.Class = olAppointment Then
            Set olkAppt = ReminderObject.Item
            Set olkMsg = Outlook.Application.CreateItem(olMailItem)
            With olkMsg
                'Change the address on the next line'
                .Recipients.Add ""
                .Subject = "Appointment Reminder"
                .HTMLBody = "Appointment: " & olkAppt.Subject & "<br>" _
                    & "Start: " & olkAppt.Start & "<br>" _
                    & "End: " & olkAppt.End & "<br>" _
                    & "Location: " & olkAppt.Location
            End With
        End If
        Set olkAppt = Nothing
        Set olkMsg = Nothing
    End Sub

    Open in new window


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    Set OWA language and time zone in Exchange for individuals, all users or per database.
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now