How to access contact groups in Excel VBA?

前端 未结 2 1701
误落风尘
误落风尘 2021-01-17 23:59

I am building an Excel add-in that sends the active workbook as an attachment in an Outlook email template to a specific Contact Group.

I\'ve gotten the first two pa

相关标签:
2条回答
  • 2021-01-18 00:43

    In order to have the recipient's email addresses or names resolved (so they don't display just plain text), you can do the following.

    With OutMail
        '.TO field should be set to the contact group
        .BCC = ""
        .Attachments.Add ActiveWorkbook.FullName
        .HTMLBody = Replace(OutMail.HTMLBody, strOldPeriod, strNewPeriod)
        .Subject = Replace(OutMail.Subject, strOldPeriod, strNewPeriod)
        'To display the email leave as is;  to send the Email, change to .Send
        .Display    'or Send
        If Not .Recipients.ResolveAll Then
            For Each Recipient In .Recipients
                If Not Recipient.Resolved Then
                    MsgBox Recipient.Name & " could not be resolved"
                End If
            Next 
        End If
    End With
    
    0 讨论(0)
  • 2021-01-18 00:56

    Just use the name of the contact group (formerly called "distribution lists"). I just tried it, as suggested on Ron de Bruin's site, and it works.

    0 讨论(0)
提交回复
热议问题