我目前使用以下内容检查Outlook VBA程序中的TO地址...
If MyEMail.Recipients.Item(1).Address = "MyAddress@gmail.com"
如何查看CC字段中的相同地址?
我在很久以前写过这篇文章,我一般都会研究如何在我做这些事情时做事,然后忘记我是怎么做以及为什么要这样做:-) !!!
答案 0 :(得分:0)
首先,你为什么要对索引(1)进行硬编码?循环遍历MyEMail.Recipients
集合中的所有收件人以及每位收件人,查看Recipiet.Type
媒体资源(可以olTo
,olCC
,olBCC
)。
for each recip in MyEMail.Recipients
if (recip.Address = "MyAddress@gmail.com") Then
if recip.Type = olTo Then
MsgBox "Sent to a To recipient"
else if recip.Type = olCC Then
MsgBox "Sent to a CC recipient"
end if
End If
next