Consulting

Results 1 to 2 of 2

Thread: Automatic emails sent through appointment reminders (Sending to a contact group)

  1. #1
    VBAX Newbie
    Joined
    Aug 2015
    Posts
    1
    Location

    Automatic emails sent through appointment reminders (Sending to a contact group)

    Hello,

    I have acode which automatically sends a calendar appointment as an email when email addresses are entered into the location field of the appointment and when it is selected as a certain category.

    However, the location section has a limited number of characters and I would like outlook to send to all of the contacts in a group.

    There is a link that I got the code from but the website won't allow me to post it.
    slipstick . c0m/developer/send-email-outlook-reminders-fires/

    And here is the code:

    Private Sub Application_Reminder(ByVal Item As Object)
    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)
    If Item.MessageClass <> "IPM.Appointment" Then
    Exit Sub
    End If
    If Item.Categories <> "Automated Email Sender" Then
    Exit Sub
    End If
    objMsg.To = Item.Location
    objMsg.Subject = Item.Subject
    objMsg.Body = Item.Body
    objMsg.Send
    Set objMsg = Nothing
    End Sub

    Thanks,
    Matt

  2. #2
    VBAX Mentor skatonni's Avatar
    Joined
    Jun 2006
    Posts
    347
    Location
    Enter the group name in location. Then objMsg.Recipients.ResolveAll

    Private Sub Application_Reminder(ByVal Item As Object)
    
    Dim objMsg As MailItem
    Set objMsg = Application.CreateItem(olMailItem)
     
    If Item.MessageClass <> "IPM.Appointment" Then
            Exit Sub
    End If
    
    If Item.Categories <> "Automated Email Sender" Then
            Exit Sub
    End If
    
    objMsg.To = Item.location
    objMsg.Recipients.ResolveAll
    
    objMsg.Subject = Item.Subject
    objMsg.body = Item.body
     
    objMsg.send
    Set objMsg = Nothing
    
    End Sub
    To debug, mouse-click anywhere in the code. Press F8 repeatedly to step through the code. http://www.cpearson.com/excel/DebuggingVBA.aspx

    If your problem has been solved in your thread, mark the thread "Solved" by going to the "Thread Tools" dropdown at the top of the thread. You might also consider rating the thread by going to the "Rate Thread" dropdown.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •