使用Outlook将电子邮件发送到通讯组列表

时间:2016-07-26 20:57:32

标签: excel vba excel-vba email outlook

我目前拥有完美的代码,可以将我已打开的活动工作簿发送给我指定的任何人。

但是,我想将工作簿发送到名为“Daily Matrix”的Outlook联系人的分发列表中,并希望将它们作为BCC。我不知道该怎么做,我们将不胜感激。谢谢!

Sub Mail_Workbook_1()
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Daily Matrix"
    .Body = "PLEASE DO NOT DISTRIBUTE-FOR INTERNAL USE ONLY"
    .Attachments.Add ActiveWorkbook.FullName
    ' You can add other files by uncommenting the following line.
    '.Attachments.Add ("C:\test.txt")
    ' In place of the following statement, you can use ".Display" to
    ' display the mail.
    .Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

您应该能够在.BCC行中使用通讯组列表的名称,但我没有对此进行测试。

.BCC = "Daily Matrix"

有关详细信息,请参阅herehere