• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Send an Email When You Add an Appointment to Your Calendar

Slipstick Systems

› Developer › Send an Email When You Add an Appointment to Your Calendar

Last reviewed on September 26, 2021     91 Comments

An Outlook Calendar owner wanted to know how to notify a delegate that a new appointment was scheduled when adding an appointment to the calendar. Solution: VBA that watches for a new appointment item and sends an email to a predetermined email address.

Generate an email when you create an appointment

To avoid sending email for personal appointments, the VBA looks for a category named "private" and only sends an email if that category is NOT assigned to the appointment. You could use a subject filter to check for the word Private as the first word in the subject instead:

If Item.Class = olAppointment And _ 
    Left(Item.Subject, 8) <> "Private:" Then 

With a little tweaking, the delegate could generate the email to the boss when she adds a new appointment to the boss's calendar.

Send an Email when a New Appointment is added to Calendar

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace
  Set Ns = Application.GetNamespace("MAPI")
  Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  On Error Resume Next

If Item.Class = olAppointment And _
   Item.Categories <> "private" Then

  Dim objMsg As MailItem
   Set objMsg = Application.CreateItem(olMailItem)

   objMsg.To = "alias@domain.com"
   objMsg.Subject = Item.Subject
   objMsg.Body = "New appointment added to " & Item.Organizer & "'s calendar." & _
     vbCrLf & "Subject: " & Item.Subject & "     Location: " & Item.Location & _
     vbCrLf & "Date and time: " & Item.Start & "     Until: " & Item.End
   
'use Display instead of Send if you want to add a note before sending
   objMsg.Send

   Set objMsg = Nothing

   End If

End Sub

Watching for new items in a non-default calendars

If the calendar is not your default calendar, you need to use the Function for non-default folders at Working with VBA and non-default Outlook Folders.

After adding the GetFolderPath function to the module, change
Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
to
Set Items = GetFolderPath("other-datafile-display-name\Calendar").Items

Don't forget to change the display name to the name that is used in the folder list.

Watch for new appointments in a Shared Calendar

To watch for updates in a shared calendar (Exchange Server), you need to resolve the recipient and use GetSharedDefaultFolder. Replace the Application_Startup macro with this, using the shared mailbox's display name as it appears in the GAL.

Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace
  Dim CalendarFolder As Outlook.Folder
  Dim objOwner As Outlook.Recipient
  
  Set Ns = Application.GetNamespace("MAPI")
  Set objOwner = Ns.CreateRecipient("Mary Contrary")
    objOwner.Resolve
     
 'MsgBox objOwner.Name

 If objOwner.Resolved Then

  Set CalendarFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
  Set Items = CalendarFolder.Items
 End If

End Sub

Watch for Updates

To watch for updates, you'll use the same code in a procedure named Private Sub Items_ItemChange(ByVal Item As Object). If you are watch for new or updated items, add this code to the module after the ItemAdd code above. If you are only watching for the ItemChange event, you need to use the Application_Startup and declaration code from above. (Or use the code above and change ItemAdd to ItemChange.)


Private Sub Items_ItemChange(ByVal Item As Object)
  On Error Resume Next
 
If Item.Class = olAppointment Then
 
  Dim objMsg As MailItem
   Set objMsg = Application.CreateItem(olMailItem)
 
   objMsg.To = "alias"
   objMsg.Subject = Item.Subject
   objMsg.Body = "Appointment changed " & Item.Organizer & "'s calendar." & _
     vbCrLf & "Subject: " & Item.Subject & "     Location: " & Item.Location & _
     vbCrLf & "Date and time: " & Item.Start & "     Until: " & Item.End
    
'use Display instead of Send if you want to add a note before sending
   objMsg.Display
 
   Set objMsg = Nothing
 
   End If
 
End Sub

Send message from Creator

If you have multiple users sharing the same calendar and set the macro up for each user, when the new calendar event syncs to each computer, multiple messages will be generated. To prevent this, use a properyaccessor to get the account name that created the appointment and compare it to the default email account name. If they match, generate the message.

This code watches the user's default calendar. See Working with VBA and non-default Outlook Folders if you need to watch a different calendar.


Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace
  Set Ns = Application.GetNamespace("MAPI")
  Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
  'On Error Resume Next

Dim CreatedByName 'As String
Dim pa As Outlook.propertyAccessor
Set olns = Application.GetNamespace("MAPI")
Set pa = Item.propertyAccessor
CreatedByName = pa.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3FFA001E")

If CreatedByName = olns.Accounts.Item(1) Then


'If Item.Class = olAppointment And _
   Item.Categories <> "private" Then
 
  Dim objMsg As MailItem
   Set objMsg = Application.CreateItem(olMailItem)
 
   objMsg.To = "alias@domain.com"
   objMsg.Subject = Item.Subject
   objMsg.Body = "New appointment added to " & Item.Organizer & "'s calendar." & "By " & CreatedByName & _
     vbCrLf & "Subject: " & Item.Subject & "     Location: " & Item.Location & _
     vbCrLf & "Date and time: " & Item.Start & "     Until: " & Item.End
'use Display instead of Send if you want to add a note before sending
   objMsg.Display 'Send
 
   Set objMsg = Nothing
 
   End If
' End If
 Set olns = Nothing
End Sub

Send an Email When You Add an Appointment to Your Calendar was last modified: September 26th, 2021 by Diane Poremsky
Post Views: 23

Related Posts:

  • Send an Email When a Reminder Fires
  • Use this macro to send an attachment to email addresses in the To line
    VBA: No attachments to CC'd recipients
  • Create a new Outlook message using VBA
  • VBA: Copy New Appointments to Another Calendar

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Liz says

    March 13, 2019 at 11:06 am

    Hi Diane,

    I'm struggling with this macro. Here is my scenario: I have two mailboxes - me@domain.com and InteractionsCalendar@domain.com, which shows up in my company's address book as Interactions Calendar. I am the "owner" of the Interactions Calendar mailbox, but it is not my default mailbox. I have granted Author permissions to other users (user3, user4, etc.) so that they can send meeting invitations on this calendar, "I" have shared the calendar with them (they received a sharing invitation from Interactions Calendar but I'm the actual person).

    I want to generate an e-mail to user2@domain.com every time I or one of the Authors adds, updates, or deletes a meeting from the Interactions Calendar. It's not my default calendar, but it's not a second calendar on my default mailbox. It's the default calendar on an entirely separate mailbox, but it's not quite like another user shared the calendar with me, because I'm the owner and have full access to this second mailbox. So I'm struggling with which code pieces to use from this page and the page on "Working with VBA and non-default Outlook Folders". Can you provide me some guidance?

    Reply
  2. Jaime L. says

    January 13, 2019 at 9:54 am

    I've been playing with your code and I can get (2) operations to work separately in the code, but not together - I can add events to calendar then it sends an email, or I can delete events and it sends an email. But I can't do both in one combined code. Can you help?

    Private WithEvents Items As Outlook.Items

    Private Sub Application_Startup()
    Dim Ns As Outlook.NameSpace
    Set Ns = Application.GetNamespace("MAPI")
    Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
    End Sub

    Private Sub Items_ItemAdd(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment And _
    Item.Categories "private" Then

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "jaime@whatever.com"
    objMsg.Subject = "New entry on Whatever's calendar"

    objMsg.Body = Item.Subject & _
    vbCrLf & "" & _
    vbCrLf & "Location: " & Item.Location & _
    vbCrLf & "" & _
    vbCrLf & Item.Start & _
    vbCrLf & "until" & _
    vbCrLf & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End If

    End Sub

    Reply
  3. Nik says

    April 10, 2017 at 3:44 pm

    Diane,

    WHat are the steps to get this to work? I have Outlook 2016. I added developer toolbar, new Macro, named it EmailCal, copy paste your code. It has a syntax error, and Private WithEvents Items As Outlook.Items is all in red.

    New to Outlook VBA, just curious if you have a step by step guide on how to create and run a module.

    Thanks

    Reply
    • Diane Poremsky says

      April 14, 2017 at 8:39 pm

      did you paste the macros in thisoutlooksession?

      Reply
  4. dean gross says

    March 19, 2017 at 8:53 pm

    I have an outlook.com that i have shared with my wife, when i make a change, she is getting an email notification that the calendar event was updated, which is not desirable. I can't find any settings to control this behavior. This is something that just recently started occurring. Do you have any idea what would be causing this or how to control it?

    Reply
    • Diane Poremsky says

      April 14, 2017 at 8:53 pm

      try options, calendar - under shared calendars.

      Reply
  5. Ray says

    June 3, 2016 at 4:28 pm

    Diane,
    Running Outlook 2013 and I'm trying to e-mail the day's calendar whenever a new mtg is scheduled. It sounds very similar to your "Send an Email when a New Appointment is added to Calendar", which I've successfully implemented, but just do not know how to access Outlook's e-mail calendar feature. I've looked at other threads, but it looks rather involved. Wish I had the record macro feature here which is common to other MS Office apps...

    Reply
  6. Edwin says

    April 29, 2016 at 10:12 am

    Hi,

    I was wondering if it would be possible to check multiple shared calendar's (Exchange Server) at the same time? How would I set this up?

    Thx

    Reply
    • Diane Poremsky says

      April 30, 2016 at 1:04 am

      You can. You need to set a unique reference for each one in the app start macro then repeat the itemadd macros - what I usually do is create 'stub' macros that pass the item to the macro that does the work, especially when everything in the macros would be identical.

      Private WithEvents Items As Outlook.Items
      Private WithEvents shared1 As Outlook.Items

      Private Sub Application_Startup()
      Dim Ns As Outlook.NameSpace
      Set Ns = Application.GetNamespace("MAPI")
      Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
      ' shared folder code goes here
      Set shared1 = ' the code
      End Sub

      Private Sub Items_ItemAdd(ByVal Item As Object)
      Dowhatever item
      End sub

      Private Sub shared1_ItemAdd(ByVal Item As Object)
      Dowhatever item
      End sub

      Sub dowhatever(ByVal Item As Object)
      On Error Resume Next
      If Item.Class = olAppointment And _
      Item.Categories <> "private" Then
      Dim objMsg As MailItem
      Set objMsg = Application.CreateItem(olMailItem)
      objMsg.To = "alias@domain.com"
      objMsg.Subject = Item.Subject
      objMsg.Body = "New appointment added to " & Item.Organizer & "'s calendar." & _
      vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
      vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End
      'use Display instead of Send if you want to add a note before sending
      objMsg.Send
      Set objMsg = Nothing
      End If
      End Sub

      Reply
      • edwin says

        May 2, 2016 at 5:04 am

        Hi,

        Thanks for you answer but I am not quite sure what I am supposed to do. ( I am new to VBA) I am currently using the following code:

        Private WithEvents Items As Outlook.Items

        Private Sub Application_Startup()
        Dim Ns As Outlook.NameSpace
        Dim CalendarFolder As Outlook.folder
        Dim objOwner As Outlook.Recipient

        Set Ns = Application.GetNamespace("MAPI")
        Set objOwner = Ns.CreateRecipient("mailadressharedfolder@company.com")
        objOwner.Resolve

        'MsgBox objOwner.Name

        If objOwner.Resolved Then

        Set CalendarFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
        Set Items = CalendarFolder.Items
        End If

        End Sub

        Private Sub Items_ItemAdd(ByVal Item As Object)
        'On Error Resume Next

        Dim CreatedByName 'As String
        Dim pa As Outlook.PropertyAccessor
        Set olns = Application.GetNamespace("MAPI")
        Set pa = Item.PropertyAccessor
        CreatedByName = "user@company.com"

        If CreatedByName = olns.Accounts.Item(1) Then

        'If Item.Class = olAppointment And _
        Item.Categories "private" Then

        Dim objMsg As MailItem
        Set objMsg = Application.CreateItem(olMailItem)

        objMsg.To = "receiver@company.com"
        objMsg.Subject = Item.Subject & " " & Item.Start
        objMsg.Body = "subject" & Item.Organizer & "'s calendar." & "By " & CreatedByName & _
        vbCrLf & "Subject: " & Item.Subject & _
        vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End & _
        vbCrLf & vbCrLf & Item.Body
        'use Display instead of Send if you want to add a note before sending
        objMsg.Send

        Set objMsg = Nothing

        End If
        ' End If
        Set olns = Nothing
        End Sub

        I am not sure how to insert a second shared mailbox in here. What kind of code do I need to insert at "set shared1= ??" Thanks.

      • Diane Poremsky says

        May 2, 2016 at 8:55 am

        Add this at the top:
        Private WithEvents sItems As Outlook.Items

        Add this to app start:
        Dim CalendarShareFolder As Outlook.folder
        Dim objOwnerS As Outlook.Recipient
        Set objOwnerS = Ns.CreateRecipient("second account")
        objOwnerS.Resolve
        If objOwnerS.Resolved Then
        Set CalendarShareFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
        Set sItems = CalendarFolder.Items

        then duplicate the items add sub, renaming it.
        Private Sub sItems_ItemAdd(ByVal Item As Object)

        if everything is identical in both itemadd macros, you could use stubs to call a 3rd macro that is shared but i have a meeting starting in 5 minutes and don't have time to do it. I have stub examples on the site though.

  7. Adam Lacey says

    April 28, 2016 at 8:52 am

    Hello,
    VBA isn't an area I know about and I'm trying to get a custom email sent to an address once a NEW appointment is added to a shared "Training" calendar.
    I have merged the code below but it's not working I believe, can someone help me please? (Using Outlook 2013 and may go to 2016 soon):

    Private Sub Application_Startup(ByVal Item As Object)
    Dim Ns As Outlook.NameSpace
    Dim CalendarFolder As Outlook.Folder
    Dim objOwner As Outlook.Recipient

    Set Ns = Application.GetNamespace("MAPI")
    Set objOwner = Ns.CreateRecipient("Training")
    objOwner.Resolve

    'MsgBox objOwner.Name

    If objOwner.Resolved Then

    Set CalendarFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
    Set Items = CalendarFolder.Items
    End If

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "MYSELF@DOMAIN.co.uk"
    objMsg.Subject = "Training appointment"
    objMsg.Body = Item.Subject & "with" & Item.Organizer & _
    vbCrLf & "Subject: " & Item.Subject & _
    vbCrLf & "#priority medium" & _
    vbCrLf & "#due" & Item.Start & _
    vbCrLf & "#set customer= CODE - NAME" & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End Sub

    Reply
    • Diane Poremsky says

      April 28, 2016 at 11:38 am

      you need two macros - the app startup to tell it which folder to watch and the itemadd that actually watches the folder.
      *snip*
      Set CalendarFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
      Set Items = CalendarFolder.Items
      End If
      End Sub

      Private Sub Items_ItemAdd(ByVal Item As Object)
      Dim objMsg As MailItem
      Set objMsg = Application.CreateItem(olMailItem)
      *snip*

      Also, you need to reference items, not item:
      objMsg.Body = Items.subject...
      You also need this at the very top of the macros:
      Private WithEvents Items As Outlook.Items

      Reply
  8. Jonathan says

    October 28, 2015 at 12:54 am

    Hi Diane,
    Great article thank you! - I was able to set up email notifications for a Public Shared Calendar when anything is added or changed in the Calendar. However, I was wondering if there is a way to get notified when something is deleted from a Calendar, and have a notification email sent which includes info about what was deleted. I was able to setup notifications using ItemRemove() - but this lacks info about what was removed. I've been trying to setup BeforeDeleteItem - but no matter what I do I can't get it to work, even with a local calendar. The script just doesn't fire when I delete something. I am using Office 365.

    Reply
    • Diane Poremsky says

      October 29, 2015 at 12:17 am

      I'll take a look and see if i can come up with something that works better then this - which only works if you use the macro, not the X button.
      Public WithEvents myItem As Outlook.AppointmentItem
      Public olApp As New Outlook.Application

      Public Sub DeleteMail()
      Const strCancelEvent = "Application-defined or object-defined error"
      On Error GoTo ErrHandler
      Set olApp = CreateObject("Outlook.Application")
      Set myItem = olApp.ActiveExplorer.Selection.Item(1)
      myItem.Delete
      Exit Sub

      ErrHandler:

      MsgBox Err.Description
      If Err.Description = strCancelEvent Then
      MsgBox "The event was cancelled."
      End If
      'If you want to execute the next instruction
      Resume Next
      'Otherwise it will finish here
      End Sub

      Private Sub myItem_BeforeDelete(ByVal Item As Object, Cancel As Boolean)

      Set objMsg = Application.CreateItem(olMailItem)

      With objMsg
      .To = "Alias@domain.com"
      .Subject = Item.Subject & " was deleted on " & Now
      .Body = Item.Start & vbCrLf & Item.Body

      .Display
      End With

      Set objMsg = Nothing

      End Sub

      Reply
      • Diane Poremsky says

        October 29, 2015 at 12:31 am

        Here's a better one - watch the deleted items folder and when an appointment items hits, create the email. it doesn't work when you delete a recurring series and I'm not sure why.

        Private WithEvents trashCalendar As Outlook.Items

        Private Sub Application_Startup()
        Dim NS As Outlook.NameSpace
        Set NS = Application.GetNamespace("MAPI")
        ' watch for new items
        Set trashCalendar = NS.GetDefaultFolder(olFolderDeletedItems).Items
        Set NS = Nothing
        End Sub

        Private Sub trashCalendar_ItemAdd(ByVal Item As Object)

        If Not TypeOf Item Is AppointmentItem Then Exit Sub

        On Error Resume Next
        Set objMsg = Application.CreateItem(olMailItem)

        With objMsg
        .To = "Alias@domain.com"
        .Subject = Item.Subject & " was deleted on " & Now
        .Body = Item.Start & vbCrLf & Item.Body
        .Display
        End With

        Set objMsg = Nothing

        End Sub

      • Jonathan says

        October 29, 2015 at 12:10 pm

        This works perfectly...but only with local calendars not Public :( - Thanks for the effort! I'm going to investigate if the exchange server settings can be tweaked.

      • Diane Poremsky says

        October 29, 2015 at 12:30 pm

        Oh, it only works on appointments you delete - it should work for any calendar item that hits your deleted items folder.

      • Jonathan says

        October 29, 2015 at 11:38 am

        Thanks Diane,
        I was able to get BeforeDeleteItem to work with local calendars, or sub-calendars - but for some reason it doesn't work with a Public shared calendar. This same code works well with the Update and New routines (on Public Shared Calendars). The only thing I notice is when I delete from a Public Calendar it says it will be permanently deleted...not sure if that's a clue.

        Here's the code I'm using so far:

        Dim WithEvents JobFolder As Outlook.Folder
        Dim objDelFolder As Outlook.Folder

        Private Sub Application_Quit()
        Set olkCalendar = Nothing
        Set JobFolder = Nothing
        Set objDelFolder = Nothing
        End Sub
        'Sets up the Calendar - drill down the folder hierarchy
        Private Sub Application_Startup()
        'Change the folder name on the next line as needed'
        Set JobFolder = Session.GetDefaultFolder(olPublicFoldersAllPublicFolders).Folders("TRSI - Canada")
        Set JobFolder = JobFolder.Folders("Marine Jobs")
        'Set JobFolder = Session.GetDefaultFolder(olFolderCalendar).Folders("Test")
        Set objDelFolder = Application.Session.GetDefaultFolder(olFolderDeletedItems)
        End Sub

        Private Sub JobFolder_BeforeItemMove(ByVal Item As Object, ByVal MoveTo As MAPIFolder, Cancel As Boolean)
        MsgBox "Fired"
        If MoveTo Is Nothing Then
        Debug.Print Item.Subject & " was hard deleted"
        MsgBox Item.Subject & "hard delete"
        ElseIf MoveTo = objDelFolder Then
        Debug.Print Item.Subject & " was moved to Deleted Items"
        MsgBox Item.Subject & "soft delete"
        End If
        End Sub

      • Diane Poremsky says

        October 29, 2015 at 1:07 pm

        >> it will be permanently deleted...not sure if that's a clue.

        I'm sure it is a clue. I know the code i used that watches the deleted items folder won't work, because the apt isn't moved to the deleted items folder. I'll play with it this afternoon.

  9. Marjorie says

    October 21, 2015 at 11:00 am

    Hi Diane,
    I'd like to receive an email when a certain category is given to an appointment. Could you please help me with the code?

    Reply
    • Diane Poremsky says

      October 23, 2015 at 6:03 pm

      That would be this line in the code - to watch for one category, change the brackets to an equal sign and change the category name to the one you want to watch for.
      If Item.Class = olAppointment And _
      Item.Categories = "private" Then

      Reply
      • Marjorie says

        October 26, 2015 at 7:29 am

        Thank you, Diana!

  10. Jesse says

    October 16, 2015 at 2:48 pm

    I am getting multiple emails when I add an appointment as well as when I adjust one. Any idea why this may be?

    Reply
    • Diane Poremsky says

      October 23, 2015 at 6:02 pm

      The code is seeing it as a new appointment. What type of email account are you using? Are you only using the macro that watches for new items, not also the one that looks for changes?

      Reply
      • Jesse says

        October 28, 2015 at 4:45 pm

        I am using an Outlook Exchange server. I am trying to use the macro for both the new and adjusted appointments.

      • Diane Poremsky says

        October 29, 2015 at 12:35 am

        I've seen this happen with the deleted events version (it's related to cached mode) but not with new and changed appt. I'll look into it.

      • Jesse says

        November 5, 2015 at 1:30 pm

        Hi Diane, have you had any luck with a solution to the multiple emails?

  11. Adrian Hernandez says

    August 19, 2015 at 10:14 am

    Thanks. The above code works great. One question, I am getting the e-mails, but, they don't have the option of Accept/Decline, w/o this option the Calendar event will no be added to my Hotmail Calendar. How can I accomplish this?

    Reply
    • Diane Poremsky says

      October 23, 2015 at 2:56 pm

      To get the accept/decline box, it needs to be sent as a meeting request. This code snippet is from the accept and forward copy to another address article.

      Set oAppt = Application.CreateItem(olAppointmentItem)

      With oAppt
      .MeetingStatus = olMeeting
      .Subject = "Accepted: " & cAppt.Subject
      .Start = cAppt.Start
      .Duration = cAppt.Duration
      .Location = cAppt.Location
      Set meAttendee = .Recipients.Add("me@mydomain.com")
      meAttendee.Type = olRequired
      .Send
      End With

      Reply
  12. Andy Knapper says

    June 29, 2015 at 11:33 am

    Hi
    Would this be able to be run at a specific time for a specific period?
    My boss likes to know what days i'm out of the office for the upcoming week, so could this be set to run on a Friday with all appointments that are tagged "out of office" for the next seven days?

    Reply
    • Diane Poremsky says

      June 30, 2015 at 12:33 am

      You can trigger macros using a reminder or other actions (reminders are the easiest). The reminder method is here: https://www.slipstick.com/developer/send-email-outlook-reminders-fires/

      Reply
  13. David Eisinger says

    April 16, 2015 at 4:13 pm

    Will this work for group calendar? Can specific people be notified by email when updating a shared or group calendar?

    Reply
    • Diane Poremsky says

      April 16, 2015 at 6:52 pm

      yes, provided its open in someone's profile. id its in a shared mailbox, replace the application startup macro with the one under Watch for new appointments in a Shared Calendar.

      Reply
  14. Paul C. says

    April 8, 2015 at 6:26 pm

    How do I get this macro to run all the time? Right now I have created the macro using your code (thanks!) but when I create a calendar appointment no email goes out. Am I missing something?

    Reply
  15. Michael Fitzpatrick says

    March 11, 2015 at 5:10 pm

    Hi Diane,

    I have to code working to send an email when a New Appointment is added to a 'Shared Mailbox' Calendar as described. I have multiple people who will need to add appointments to this calendar. I have the macro code setup on each of their Outlook clients. the problem is that when anyone add a new appointment, an email is sent from all the users.

    How can this be configured so that the only email is sent is from the user who added the appointment?

    Thanks.

    Reply
    • Diane Poremsky says

      March 11, 2015 at 7:48 pm

      I think the best method is to check for the organizer and if the organizer is your account, send it.

      Reply
    • Diane Poremsky says

      March 11, 2015 at 9:35 pm

      Try adding this code above the if line -

      Dim CreatedByName 'As String
      Dim pa As Outlook.propertyAccessor
      Set olns = Application.GetNamespace("MAPI")
      Set pa = Item.propertyAccessor
      CreatedByName = pa.GetProperty("https://schemas.microsoft.com/mapi/proptag/0x3FFA001E")
      If CreatedByName = olns.Accounts.Item(1) Then

      (and another end if at the end)

      Reply
    • Michael Fitzpatrick says

      June 25, 2015 at 3:12 pm

      Hi Diane, I tried to post this a few days ago, but it has disappeared...

      I cannot seem to get this additional code to only 'Send message from Creator' to work. Now nothing happens when I add a calendar entry. Can you confirm the code works? There seems to be a few differences between what is here in your March 11 post, versus what's further up in the 'Send Message from Creator' page section with the full code. Some code is commented out.

      Any assistance will be appreciated, thanks.

      Reply
      • Diane Poremsky says

        June 26, 2015 at 10:44 am

        I assume you mean this commented out line - that just removes watching for the appointment class. Since you are watching the calendar, you don't really need to check the type.
        If CreatedByName = olns.Accounts.Item(1) Then
        'If Item.Class = olAppointment And _
        Item.Categories <> "private" Then

        Are you using this from the first macro? You need these lines from the first one - the later macros on the page just replace the itemadd macro.

        Private WithEvents Items As Outlook.Items

        Private Sub Application_Startup()
        Dim Ns As Outlook.NameSpace
        Set Ns = Application.GetNamespace("MAPI")
        Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
        End Sub

    • Michael Fitzpatrick says

      July 26, 2015 at 6:09 pm

      Hi again Diane,

      I'm still trying to get this to work. I am almost there. I am selecting the shared calendar Event Scheduler in the Application Startup and this works fine. I believe the problem for me is in my Items_Add code definitions. If I comment out the "If CreatedByName = olns.Accounts.Item(1) Then", the email does get sent in my tests and does have my name as the CreatedByName. What am I missing here? Is it in the Set olns= somewhere? (I changed my email address in this post).

      I really need to get this to work!.
      Thanks so much, Michael.

      Private WithEvents Items As Outlook.Items

      Private Sub Application_Startup()
      Dim Ns As Outlook.NameSpace
      Dim CalendarFolder As Outlook.Folder
      Dim objOwner As Outlook.Recipient

      Set Ns = Application.GetNamespace("MAPI")
      Set objOwner = Ns.CreateRecipient("Event Scheduler")
      objOwner.Resolve

      MsgBox objOwner.Name

      If objOwner.Resolved Then

      Set CalendarFolder = Ns.GetSharedDefaultFolder(objOwner, olFolderCalendar)
      Set Items = CalendarFolder.Items
      End If

      End Sub

      Private Sub Items_ItemAdd(ByVal Item As Object)
      'On Error Resume Next

      Dim CreatedByName 'As String
      Dim pa As Outlook.PropertyAccessor
      Set olns = Application.GetNamespace("MAPI")
      Set pa = Item.PropertyAccessor
      CreatedByName = pa.GetProperty("https://schemas.microsoft.com/mapi/proptag/0x3FFA001E")

      If CreatedByName = olns.Accounts.Item(1) Then

      'If Item.Class = olAppointment And _
      Item.Categories "private" Then

      Dim objMsg As MailItem
      Set objMsg = Application.CreateItem(olMailItem)

      objMsg.To = "EventAdmins@company.com"
      objMsg.Subject = Item.Subject
      objMsg.Body = "New appointment added to " & Item.Organizer & "'s calendar " & "by " & CreatedByName & _
      vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
      vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End
      'use Display instead of Send if you want to add a note before sending
      objMsg.Send 'Display

      Set objMsg = Nothing

      ' End If
      End If
      Set olns = Nothing
      End Sub

      Reply
      • Diane Poremsky says

        July 29, 2015 at 9:43 pm

        I think the problem is that olns.Accounts.Item(1) is getting your email address (the account display name) but createdby is using your display name from the AD.

        There is a way to update the account name to a display name, but it would probably be better to lookup the account's display name.

  16. danielg27 says

    December 10, 2014 at 5:37 am

    Hi Diane,

    How can I use this to constantly monitor a shared calendar? As I understand, this will only work if the Outlook client is open. Is there a way to constantly monitor a shared calendar if new items are added to it?

    Thanks in advance!

    Reply
    • Diane Poremsky says

      January 21, 2015 at 12:20 am

      Yes, you would need Outlook open to use a macro to monitor the shared folder (or any folder) using VBA. You can't monitor the folder when Outlook is closed - doing so would require scripts running on the server and the administrator would need to set it up.

      Reply
  17. Carl says

    November 20, 2014 at 2:33 pm

    So I am pretty sure I know what is going on. In this code I am attempting to use the EntryID from a incoming AppointmentItem Object and set it to my newly created MailItem Object which is why I am getting a type mismatch. I can create a new AppointmentItem and set the EntryID of the Incoming "Item" Object to that variable but I am unsure how I set up the test as I am really not sure what this is accomplishing. I assume that I am testing to see if the EntryID is the same as it was when created indicating nothing has changed so there is no need to send an email. Only if the EntryID is different (Which I assume would indicate a change to the appointment) would I need to send an email.

    Does this make sense? Or am I totally off on the logic of the code?

    Thanks again Diane

    Reply
    • Diane Poremsky says

      November 20, 2014 at 5:30 pm

      Change mailitem to object
      Dim objMsg As object
      and see if it works.

      Reply
  18. Carl says

    November 19, 2014 at 6:09 pm

    Hi Diane!

    Is there any way I can get you to walk my through what you mean by using the entryid to avoid the 3 email issue with exchange? I would really appreciate it. Here is my code for the ItemChange

    Private Sub ItemsLrg_ItemChange(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment Then

    Dim iD As String
    iD = Item.EntryID

    Dim objMsg As MailItem
    Set objMsg = Application.Session.GetItemFromID(iD)

    objMsg.To = "someone@work.com"
    objMsg.Subject = "Large Conference Room Appointment Modified"
    objMsg.Body = "Appointment changed " & Item.Organizer & "'s calendar." & _
    vbCrLf & "Subject: " & Item.Subject & _
    vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End

    objMsg.Display

    Set objMsg = Nothing

    End If

    End Sub

    Set this way I no longer get 3 emails when the appoint is first made but I also do not get any messages when the appointment is changed.

    If I have my code setup like your initial code shows above I get the 3 emails when creating or modifying an appointment.

    I am not too familiar with VBA as I am mainly java and c#

    Also can you direct me to a good API resource for VBA? I am trying to get an email setup when someone deletes an appointment as well.

    Thank you so much for these procedures they helped me in finding a solution I have been working on :).

    Reply
    • Diane Poremsky says

      November 20, 2014 at 1:33 am

      Reply the two lines that Dim and Set objmsg with the following:
      Dim strID As String
      Dim objMsg As MailItem
      strID = Item.EntryID
      Set objMsg = Application.Session.GetItemFromID(strID)

      The best resource is usually MSDN - https://msdn.microsoft.com/en-us/library/office/fp161224(v=office.15).aspx

      Reply
      • Carl says

        November 20, 2014 at 11:58 am

        Hi DIane!,

        Thank you for the speedy reply I very much appreciate it. So I ran the changes you suggested as shown:

        Dim strID As String
        Dim objMsg As MailItem
        strID = Item.EntryID
        Set objMsg = Application.Session.GetItemFromID(strID)

        However I am getting a runtime error '13' Type mismatch at the line:
        Set objMsg = Application.Session.GetItemFromID(strID)

        This occurs during the next sync cycle from the exchange server after I add an event to the calendar and receive the initial email for appt made.

        I tried a few datatype changes to fix the issue but would get other errors.

        If it matters I am running Outlook 2010 and Exchange server 2010. I apologize if this is a trivial error but don't seem to have a lot of luck finding specific solutions on other sites.

        Thanks again!

  19. Chris says

    September 18, 2014 at 4:51 am

    Brilliant.

    A "me too" on the sending three times on update.

    I tweaked the original to send as vcs file, so can be accepted by my gmail calendar

    Private Sub Items_ItemAdd(ByVal Item As Object)
    Dim oForward As MailItem

    If TypeName(Item) = "AppointmentItem" Then
    'Forward the appointment
    Set oForward = Item.ForwardAsVcal
    oForward.Recipients.Add ("bob@gmail.com")

    'Send it
    oForward.Send
    Set oForward = Nothing
    End If

    Reply
    • Diane Poremsky says

      September 18, 2014 at 2:41 pm

      An exchange account will create up to 3 items under certain circumstances (like macros that create a new item when one is updated) - it's due to syncing updates. Using the entryid for the item that triggers it works as does adding a category and using an if statement that looks for any category but that one. I'll see if i can get this one to repro and see if the entryid solution fixes it.

      Reply
      • Chris says

        September 25, 2014 at 5:08 am

        Many thanks, alas, not "official" work, so I can't dig too deep. Just trying to get my work appointments on personal phone as we are about to switch off "unmanaged" access

  20. hello123 says

    September 12, 2014 at 4:05 pm

    I am not able to run the code "Send an Email when a New Appointment is added to Calendar". It says error in the first line at "private WithEvents.......". Could anyone solve this issue since its quite urgent.

    Reply
    • Diane Poremsky says

      September 14, 2014 at 12:22 am

      Family is sleeping so i can't talk, but here is a silent video showing how it works -
      https://www.screencast.com/t/Bb2yFp02oDg2

      (it doesn't show checking the macro security settings.)

      Reply
  21. Jami Backer says

    September 12, 2014 at 11:39 am

    I'm currently using this code and it's working beautifully. I do however wonder if there is more code to add that would make the notification email appear in red. Thanks!

    Reply
    • Diane Poremsky says

      September 12, 2014 at 12:19 pm

      If you want it to show up in your message list in red, make it past due. However, outlook can make this difficult and remove past due reminders - if so add a flag for follow up text and make a conditional rule to display messages with this flag in color
      objMsg.FlagRequest = "Appointment added to calendar"

      past due code is objMsg.TaskDueDate = Now - 1

      Reply
  22. yodelayheewho says

    July 14, 2014 at 9:21 pm

    Hi Diane,

    I changed the objmsg.send line to objmsg.display.

    Then, when I add Private WithEvents Items As Outlook.Items to the very first line. It turns red and I get the following error message: "Compile error: Only valid in object module".

    I click ok to get rid of the error message.

    When I try to click Run, then the macro dialog box pops up asking me to name the macro. So, I named it: HomeCalendarEMailedToWorkCalendar and it places the following underneath all of the code:

    Sub HomeCalendarEMailedToWorkCalendar()

    End Sub

    Reply
    • Diane Poremsky says

      July 15, 2014 at 12:01 am

      Did you put the macro in ThisOutlookSession?

      Reply
  23. yodelayheewho says

    July 12, 2014 at 10:29 pm

    Hi Diane,

    I finally was able to hit 'run' and get no error messages for the following code (I substituted my work email address and my name with the word "alias").

    I ran a test, creating an appointment in Outlook 2013 on my home PC laptop with my work PC laptop next to me, with Outlook 2010 open. I never received an email notifying me that I scheduled an appointment on my home PC:(

    I feel like I'm so close to solving this. What am I missing?

    Private Sub Application_Startup()
    Dim Ns As Outlook.NameSpace
    Set Ns = Application.GetNamespace("MAPI")
    Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
    End Sub
    Private Sub Items_ItemAdd(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment Then

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "alias"
    objMsg.Subject = Item.Subject
    objMsg.Body = "New appointment added to alias's personal calendar" & Item.Organizer & "alias's work calendar." & _
    vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
    vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End If

    End Sub

    Private Sub Items_ItemChange(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment Then

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "alias"
    objMsg.Subject = Item.Subject
    objMsg.Body = "Appointment changed on alias's personal calendar" & Item.Organizer & "alias's work calendar." & _
    vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
    vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End If

    End Sub

    Sub HomeCalendarEMailedToWorkCalendar()

    End Sub

    Reply
    • Diane Poremsky says

      July 14, 2014 at 12:00 am

      change the objmsg.send line to objmsg.display - see if the message opens on screen.
      Not sure what this is supposed to do:
      Sub HomeCalendarEMailedToWorkCalendar()

      End Sub

      but the reset of the code looks good. Well, except for the missing first line: Private WithEvents Items As Outlook.Items. With that added, the code works here.

      Reply
  24. saju says

    June 20, 2014 at 1:09 pm

    Hi Diane

    Is there a way to get notified by email whenever a change is made in a shared calendar by some one else? I understand that the above codes are for sending emails to others when one tries to create a new appointment or updates an already existing appointment in a shared calendar.

    Reply
    • Diane Poremsky says

      June 21, 2014 at 4:57 pm

      You can use the code with a shared calendar, provided the calendar was in your Outlook profile. It should run when it detects a new item in the calendar (if you set it to watch the correct calendar), although I'm not sure it will detect changes to events.

      Reply
  25. Darryl says

    June 12, 2014 at 7:20 pm

    Diane,

    I have copied and pasted the script into ThisOutlookSession and when I click the save button and then try to run it, it pulls up the Macros box and there is nothing to select to run. What am I missing here? This is my first time working with scripts. Thank you.

    Reply
    • Diane Poremsky says

      June 12, 2014 at 10:28 pm

      Its an application start macro. Click in the application start macro and click run or restart outlook to start it. Macros with 'sub name (something here)' format are called by other macros.

      Reply
  26. Lauren says

    May 27, 2014 at 5:38 pm

    Diane,

    I can't get it to work at all for whatever reason. I don't have the option to "run" after I input the code in a module. Suggestions?

    Thanks!

    Reply
    • Diane Poremsky says

      May 27, 2014 at 7:03 pm

      There should be a Run icon in the tool bar, or press F5 to start it.

      Reply
  27. yodelayheewho says

    February 9, 2014 at 5:13 pm

    Diane,

    Now, when I close and reopen Outlook 2013, I get the following message:
    "This file contains macros with an expired or revoked signature. Since you are running under High Security Level, these macros will be disabled."

    Reply
    • Diane Poremsky says

      February 9, 2014 at 9:00 pm

      For testing you need to use low security, then when the macro is finished, sign it and set security to signed only. The reason for this is because every time you change the macro, you need to re-sign it.

      Reply
  28. yodelayheewho says

    February 9, 2014 at 5:10 pm

    Diane,
    I tried to run the macro (below) and I got this message: "The macros in this project are disabled. Please refer to online help or documentation of the host application to determine how to enable macros."

    I found a tip on the Internet suggesting I digitally sign the macro. So, I did. I closed Outlook 2013 and opened it again. And got the message above.

    My Macro Settings in the Trust Center are: "Notifications for digitally signed macros, all other macros disabled."

    Another tip was to change the Macro Settings in the Trust Center to: "Enable all macros..." I am not comfortable with this as it may be 'potentially dangerous'.

    Here's the code I have:

    Private Sub Application_Startup()
    Dim Ns As Outlook.NameSpace
    Set Ns = Application.GetNamespace("MAPI")
    Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
    End Sub
    Private Sub Items_ItemAdd(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment Then

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "work email address here"
    objMsg.Subject = Item.Subject
    objMsg.Body = "New appointment added to My personal calendar" & Item.Organizer & "My work calendar." & _
    vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
    vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End If

    End Sub

    Private Sub Items_ItemChange(ByVal Item As Object)
    On Error Resume Next

    If Item.Class = olAppointment Then

    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)

    objMsg.To = "work email address here"
    objMsg.Subject = Item.Subject
    objMsg.Body = "Appointment changed on My personal calendar" & Item.Organizer & "My work calendar." & _
    vbCrLf & "Subject: " & Item.Subject & " Location: " & Item.Location & _
    vbCrLf & "Date and time: " & Item.Start & " Until: " & Item.End

    'use Display instead of Send if you want to add a note before sending
    objMsg.Send

    Set objMsg = Nothing

    End If

    End Sub

    Any suggestions?

    Reply
    • Diane Poremsky says

      February 9, 2014 at 9:07 pm

      The macro code is not causing the error. Does it work when macro security is set to low? If so, the code is fine. Using low during testing is safe - you can see all the code. :)

      Once you are satisfied with the code, sign it and trust the signature then set the security to high. I have a video tutorial here - https://www.slipstick.com/developer/how-to-use-outlooks-vba-editor/

      Reply
    • Diane Poremsky says

      February 9, 2014 at 9:17 pm

      Hmmm. I decided i need to redo the video and guess what... I'm getting the same message on a signed macro. :(

      Reply
    • Diane Poremsky says

      February 9, 2014 at 10:09 pm

      Ok... not sure what fixed it, installing waiting updates or publishing the certificate in Trusted root, then Trusting it when the dialog comes up when restarting outlook. It also works to restart Outlook using Run as Admin once, so you can accept the certificate.

      Reply
  29. Lori says

    January 26, 2014 at 12:50 pm

    Hello Diane, I am not a developer and concerned with inputting code that I'm not familiar with. I am wondering if you can help a novice set this up so any time I add a "personal" calendar item to my "personal" Outlook calendar, either via iphone/ipad/laptop, it automatically sends an email to my work email address. More and more I want to keep work and personal separate. This way I can create a separate personal calendar at work, from the emails I would send myself, which no one has access to, and overlay it with my work calendar to identify any conflicts, etc. Perhaps if you can tell me which elements in the code above need to be customized, I can do this myself.

    Reply
    • Diane Poremsky says

      January 26, 2014 at 9:23 pm

      The macro under Send an Email when a New Appointment is added to Calendar is all you need - if you are going to send the email for all appointments, change
      If Item.Class = olAppointment And _
      Item.Categories <> "private" Then
      to
      If Item.Class = olAppointment Then

      and of course, enter the address you want the appt sent to. When you create an appt on a smartphone, the email won't be generated until the device syncs with Outlook. And outlook needs to be open for the macro to work.

      Reply
  30. Austin says

    October 3, 2013 at 9:12 am

    I guess I should of stated my goal. I have a Public Calendar in the Public Folders that I want to get email notifications when anything is added or changed.
    thanks.

    Reply
  31. Austin Knobloch says

    October 3, 2013 at 9:10 am

    I am having trouble getting this implemented. I added this code as a "Class Module," but when I add an event nothing happens...Any help would be appreciated!

    Reply
    • Diane Poremsky says

      October 3, 2013 at 10:49 am

      Do you have macro security set to low? Is the application startup macro in thisoutlooksession? That is a requirement. (You'll need to change the folder you're watching in application_startup too.)

      Reply
  32. Mike says

    September 12, 2013 at 3:56 am

    Thank you for the swift reply. Using Item.Categories the code works. I've run into a slightly different problem. If the appointment has more than one category assigned to it e.g. Book and Internal then it seems that the script ignores it. Is this right and is there a way to send an email for any appointment that has the "Book" category set?

    The If ... then statement I'm using looks like this:-

    If Item.Class = olAppointment And Item.Categories = "Book" Then

    Thanks in advance.
    Mike

    Reply
    • Diane Poremsky says

      September 12, 2013 at 5:56 am

      Categories is a string, and the entire string is checked - if you use multi categories, you need to check for parts of the string, using Instr:

      InStr(Item.Categories, "Book")

      Reply
  33. Mike says

    September 11, 2013 at 8:59 am

    Hello Diane. Thanks for the code. However, I am struggling to get the If... Then statement to filter correctly. I would like an email sent only when the new appointment has a certain category set. I'm using this code:-

    If Item.Class = olAppointment And Items.Categories = "Book" Then

    Unfortunately, the script sends an email regardless of the category set.

    Any ideas?
    Thanks!

    Reply
    • Diane Poremsky says

      September 11, 2013 at 9:08 am

      Typo? Items.Categories should be Item.Categories

      Reply
    • Diane Poremsky says

      September 11, 2013 at 9:11 am

      Also, the category name is case sensitive - I assume the category name is Book with a capital B, so you can consider this just an FYI and a warning for others who might use lower case in the code.

      Reply
  34. Josh says

    August 5, 2013 at 8:20 am

    Thanks Diane. I was able to make the ItemChange function work, but it is sending three emails for every change. Thoughts? Note: This is not my default calendar. It is a secondary calendar that I have shared.

    Reply
    • Diane Poremsky says

      August 6, 2013 at 11:36 am

      What code are you using for itemchange?

      Reply
      • Elizabeth says

        August 8, 2014 at 1:45 pm

        I am having the same issues as Josh with three e-mails for ItemChange. Here's the code I'm using:

        Private WithEvents Items As Outlook.Items

        Private Sub Application_Startup()
        Dim Ns As Outlook.NameSpace
        Set Ns = Application.GetNamespace("MAPI")
        Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
        End Sub
        Private Sub Items_ItemAdd(ByVal Item As Object)
        On Error Resume Next

        If Item.Class = olAppointment And _
        Item.Categories "Private" Then

        Dim objMsg As MailItem
        Set objMsg = Application.CreateItem(olMailItem)

        objMsg.To = "boss1@job.com"
        objMsg.CC = "boss2@job.com"
        objMsg.Subject = "Appointment Added to " & Item.Organizer & "'s Calendar."
        objMsg.Body = "A new appointment has been added to " & Item.Organizer & "'s calendar." & _
        vbCrLf & "Subject: " & Item.Subject & " " & _
        vbCrLf & "Location: " & Item.Location & " " & _
        vbCrLf & "Date and time: " & Item.Start & " until " & Item.End

        objMsg.Display

        Set objMsg = Nothing

        End If

        End Sub

        Private Sub Items_ItemChange(ByVal Item As Object)
        On Error Resume Next

        If Item.Class = olAppointment And _
        Item.Categories "Private" Then

        Dim objMsg As MailItem
        Set objMsg = Application.CreateItem(olMailItem)

        objMsg.To = "boss1@job.com"
        objMsg.CC = "boss2@job.com"
        objMsg.Subject = "Appointment Changed on " & Item.Organizer & "'s Calendar."
        objMsg.Body = "An existing appointment has been changed on " & Item.Organizer & "'s calendar." & _
        vbCrLf & "Subject: " & Item.Subject & " " & _
        vbCrLf & "Location: " & Item.Location & " " & _
        vbCrLf & "Date and time: " & Item.Start & " until " & Item.End

        objMsg.Display

        Set objMsg = Nothing

        End If

        End Sub

        -----
        Any ideas what is causing this? I really don't want to bombard my bosses with three e-mails every time I move my own appointments around, though obviously I'd like to notify them when my schedule changes. I've got it set to Display for now, so I am avoiding that, but I'd like to change it to Send eventually so it just happens without me thinking about it.

        Additional Questions:
        How can I set additional categories not to fire an e-mail? For example, my category for Bills. I just don't know the coding. Do I use commas or a separate line?

        I also have appointments scheduled on the weekends, which my bosses don't need to be notified of. Is there a way to limit e-mails to those appointments scheduled during my set working hours?

        Thank you for your assistance!

      • Diane Poremsky says

        September 25, 2014 at 9:51 am

        I figured this out the other day, at least for marking tasks complete. It should apply to appointments too, although I'm not sure if the fix will work the same. When cached mode syncs changes every 20~ seconds, it sees the item on the server was changed and runs the macro on the item as it syncs, even though it was already run. I'll see if the task solution might work here.

  35. Josh says

    July 30, 2013 at 12:03 pm

    How can I make this work to also notify of appointment removal or changes?

    Reply
    • Diane Poremsky says

      July 31, 2013 at 10:28 pm

      You can. You need to watch for delete and update events. Copy the ItemAdd macro and change the name of the copy to
      Private Sub Items_ItemChange(ByVal Item As Object)

      Using ItemRemove is a bit trickier (and isn't working for me tonight.) Same code, macro goes in a class module and is named Public Sub Items_ItemRemove() and you need a handler -

      Public Sub Initialize_handler()
      Set Items = Application.GetDefaultFolder(olFolderCalendar).Items
      End Sub

      Reply
  36. Joseph says

    May 29, 2013 at 7:05 am

    How can I get this to work with a script in the rules? I want an email automatically sent to the sender with a message in the body of my email only when I have a calendar event set to "Out of Office" during the time the email was sent to me.

    Thanks!

    Reply
  37. Neil Sams says

    March 5, 2013 at 5:12 am

    Sorry,
    I cannot get this to work?

    Reply
    • Diane Poremsky says

      March 5, 2013 at 7:39 am

      Do you get any error messages?
      Do you have macro security set to low?
      Did you restart Outlook or click in the Application Startup macro and click the Run button?

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 3

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.