将多个与会者添加到Meeting Invite

时间:2017-12-02 17:38:09

标签: excel vba outlook-vba

我尝试添加多个与会者,但只有最后一个电子邮件地址在.To区域中说明。

测试1:

    .RequiredAttendees = "me@me.com;"

    .RequiredAttendees = "you@you.com"

测试2:

    .RequiredAttendees = "me@me.com; you@you.com"

完整代码:

Sub MeetingInvite()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
    .EnableEvents = False
    .ScreenUpdating = False
End With

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(1)
On Error Resume Next
With OutMail
    .RequiredAttendees = "me@me.com;"
    .RequiredAttendees = "you@you.com"
    .Subject = "Meeting"
    .Importance = True
    .Body = "Meeting Invite" & Format(Date)
    .Display
End With

Set OutMail = Nothing
Set OutApp = Nothing
Unload Emy
End Sub

我需要添加大约30个电子邮件地址。

1 个答案:

答案 0 :(得分:0)

您正在尝试更改RequiredAttendees。此属性仅包含所需与会者的显示名称。

应使用“收件人”集合设置与会者列表。 试试这个:

With OutMail
    .Recipients.Add ("me@me.com")
    .Recipients.Add ("you@you.com")
    .Subject = "Meeting"
    .Importance = True
    .Body = "Meeting Invite" & Format(Date)
    .Display
End With

或者,如果您想从工作表中读取与会者:

With OutMail
    For Each cell In Range("C2:C10")
        .Recipients.Add (cell.Value)
    Next cell
    .Subject = "Meeting"
    .Importance = True
    .Body = "Meeting Invite" & Format(Date)
    .Display
End With

当然,如果您真的想通过邮件邀请30位与会者,那么提前几天安排会议可能是明智的,而不是今天邀请他们...