Can someone write me a macro for Office Outlook? RRS feed

  • Question

  • I need a prompt or something for Outlook so that when I am composing a new message and I select a contact, if that contact has a specific note then I need to add another contact.

    For example, I have multiple contacts for a company. Say I want to send an email to one of them and I have written in the notes "Send to A/P", I would like a pop up or something to remind me that I also need to send the email to the A/P contact as well.

    Or maybe it could also work if when I attach a contact to an email, it attaches 2 (the one I need, and the A/P contact)

    I keep forgetting to attach the A/P contact for some companies and I need something to prompt or remind me which companies and who to send to for each.

    Does this make any sense??

    Tuesday, October 13, 2015 1:23 PM


  • Hi JackieZin,

    Based on the description, you want to do some custom action when you add a specific contact. We can use MailItem.PropertyChange Event to track the changes in MailItem.To propery and analyse the contact.

    Here is a simple demo that for your reference:


    Private WithEvents a As MailItem
    Sub init(aa As MailItem)
    Set a = aa
    End Sub
    Private Sub a_PropertyChange(ByVal Name As String)
    If LCase(Name) = "to" Then
    If InStr(a.To, "contact1") <> 0 And InStr(a.To, "contact2") = 0 Then
        a.To = a.To & ";" & "contact2"
        MsgBox "prompt msg here."
    End If
    End If
    End Sub

    Here are some helpful links for you learning Outlook developing:

    How do I... (Outlook VBA reference)

    Outlook VBA reference

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 14, 2015 3:08 AM