【发布时间】:2020-06-24 04:46:18
【问题描述】:
我创建了一个 Outlook 宏,如果我想在列出的电子邮件 ID 之外发送电子邮件,它会给我一个弹出窗口。但是,我无法将多个电子邮件 ID 添加到列表中。请找到我编写的以下代码。有人可以帮我如何在下面的代码中添加多个电子邮件 ID 吗?
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Const ADDR_TO_WATCH_FOR = "James.t@outlook.com"
Dim olkRec As Outlook.Recipient
If Item.Class = olMail Then
For Each olkRec In Item.Recipients
If LCase(olkRec.Address) <> ADDR_TO_WATCH_FOR Then
If MsgBox("This message is addressed to " & ADDR_TO_WATCH_FOR & ". Are you sure you want to send it?", vbQuestion + vbYesNo, "Confirm Send") = vbNo Then
Cancel = True
End If
Exit For
End If
Next
End If
Set olkRec = Nothing
End Sub
【问题讨论】: